完整elasticsearch安裝及其插件安裝

一、elasticsearch安裝
1、官網下載安裝包並上傳並解壓
2、es下建立data和logs目錄
3、編輯conf/elasticsearch.yml文件
    cluster:cluster.name:hlh-app
    node:node.name:node-248
    paths:    path.data:
        path.logs:
    memory:bootstrap.memory_lock:false
        bootstrap.system_call_filter:false
    network: network.host:192.168.102.248
    discovery:discovery.zen.ping.unicast.hosts:["hlh001"]
4、編輯/etc/security/limits.conf添加內容
    * soft nofile 65536
    * hard nofile 131072
    * soft nproc 2048
    * hard nproc 4096
5、切換root用戶,編輯/etc/security/limits:d/90-nproc.conf
    修改*soft nproc 1024
      爲*soft nproc 2048
6、root用戶,編輯/etc/sysctl.conf添加
    vm.max_map_count=655360
    並執行命令:sysctl -p
7、啓動,root不可以啓動,./bin/elasticsearch
   瀏覽器訪問:hlh001:9200

二、elasticsearch插件安裝
1、下載插件 ---> https://github.com/mobz/elasticsearch-head
   下載node.js ---> https://nodejs.org/dist/   ---> node-v6.9.2.tar.xz
   上傳並解壓uzip elasticsearch-head-master.zip -d /opt/module
2、配置nodejs環境變量/etc/profile source一下
    node -v
    npm -v
3、查看head目錄下有無node_modules/grunt目錄
    沒有則執行創建
    npm install grunt --save
4、安裝head插件npm install -g cnpm --registry=registry.npm.taobao.org
5、安裝grunt
    npm install -g grunt-cli
6、編輯Gruntfile.js 文件93行options裏面添加
    hostname:'0.0.0.0',
7、檢查head目錄下是否存在base文件夾
   沒有就將_site下的base文件夾及其內容複製到head根目錄下
    head]$ mkdir base
    _site]$ cp base/* ../base/    
8、啓動grunt server -d提示有些模塊沒有安裝,執行
    npm install grunt-contrib-clean -registry=https://registry.npm.taobao.org
    npm install grunt-contrib-concat -registry=https://registry.npm.taobao.org
    npm install grunt-contrib-watch -registry=https://registry.npm.taobao.org
    npm install grunt-contrib-connect -registry=https://registry.npm.taobao.org
    npm install grunt-contrib-copy -registry=https://registry.npm.taobao.org
    npm install grunt-contrib-jasmine -registry=https://registry.npm.taobao.org
    最後一個可能安裝不成功,但是不影響使用
    啓動grunt server -d
    訪問瀏覽器hlh001:9100發現集羣未連接
9、在elasticsearch/conf路徑下編輯elasticsearch.yml添加跨域訪問
    http.cors.enabled:true
    http.cors.allow-origin:"*"
    啓動elasticsearch
10、重啓head插件訪問瀏覽器就可以了
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章