ES(elasticsearch)安裝使用
阿新 • • 發佈:2019-04-24
記得 nbsp cast sea grunt blank file flight delayed
首先配置系統參數(各個節點均需要配置)
1. 設置內核參數 vim /etc/sysctl.conf 添加如下內容: fs.file-max=65536 vm.max_map_count=262144 之後可以使用sysctl –a查看 –p刷新 2. 設置資源參數 vim /etc/security/limits.conf 添加如下內容: * soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096 3. 修改進程數 (7.x是修改20-nproc.conf文件) vim /etc/security/limits.d/90-nproc.conf 修改( * soft nproc )的值為2048
1、下載es:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.15.tar.gz
解壓配置vim /opt/es-5.6/config/elasticsearch.yml(分發各個節點,ip和name不同)
cluster.name: my-es # 集群名字,如果有2個以上集群,名字需要唯一 node.name: node1 # 節點名 network.host: 192.168.88.131 http.port: 9200 discovery.zen.ping.unicast.hosts: ["192.168.88.131", "192.168.88.132", "192.168.88.133"] # 如果要使用head,那麽需要增加新的參數,使head插件可以訪問es http.cors.enabled: true http.cors.allow-origin: "*"#centos 6.5 版本中,啟動時報錯:system call filters failed to install;
#check the logs and fix your configuration or disable system call filters at your own risk
#添加該配置項
bootstrap.system_call_filter: false
啟動不能用root
#使用root用戶創建es普通用戶 useradd es #設置elasticsearch文件夾的歸屬 chown -R es /usr/local/elasticsearch #切換為es用戶 su es #切換目錄到es的bin目錄下 cd /usr/local/elasticsearch/bin #當前窗口啟動es服務 或者加 -d 參數後臺啟動 ./elasticsearch
curl http://node1:9200/?pretty 測試一下,然後分發,不同節點的node.name和network.host不同,然後各個節點啟動即可
curl http://node1:9200/_cluster/health?pretty
{ "cluster_name" : "my-es", "status" : "green", "timed_out" : false, "number_of_nodes" : 3, "number_of_data_nodes" : 3, "active_primary_shards" : 0, "active_shards" : 0, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 0, "delayed_unassigned_shards" : 0, "number_of_pending_tasks" : 0, "number_of_in_flight_fetch" : 0, "task_max_waiting_in_queue_millis" : 0, "active_shards_percent_as_number" : 100.0 }
2、node安裝
下載解壓 http://nodejs.cn/download/ tar -zxvf node-10.15
export NODE_HOME=/opt/node-10.15 export NODE_PATH=$NODE_HOME/lib/node_modules export PATH=$PATH:$NODE_HOME/bin
記得source生效一下
node -v npm -v 看一下版本
3、grunt安裝
下載地址https://gruntjs.com/
ES(elasticsearch)安裝使用