curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.0.tar.gz
tar -xvf elasticsearch-5.2.0.tar.gz
vim /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
vim /etc/sysctl.conf
添加下面配置:
vm.max_map_count=262144
保存后执行命令
sysctl -p
vim /cy/server/elasticsearch-5.2.0/config/elasticsearch.yml
cluster.name: elasticsearch
node.name: node1
path.data: /mnt/data
path.logs: /mnt/logs
network.host: xx.134
http.port: 9200
discovery.zen.ping.unicast.hosts: ["xx.134", "xx.135", "xx.136"]
discovery.zen.minimum_master_nodes: 3
cluster.name: elasticsearch
node.name: node1
path.data: /mnt/data_1/data
path.logs: /mnt/data_1/logs
network.host: xx.162
http.port: 9200
discovery.zen.ping.unicast.hosts: ["xx.162", "xx.163", "1xx.164"]
discovery.zen.minimum_master_nodes: 3
cluster.name: elasticsearch
node.name: node1
path.data: /mnt/data_1/data
path.logs: /mnt/data_1/logs
network.host: xx.226
http.port: 9200
discovery.zen.ping.unicast.hosts: ["xx.226", "xx.227", "xx.228", "xx.229", "xx.230", "xx.231"]
discovery.zen.minimum_master_nodes: 6
#开启跨域访问支持,默认为false
http.cors.enabled: true
#跨域访问允许的域名地址,(允许所有域名)以上使用正则
http.cors.allow-origin: "/.*/"
#赋予admin权限
chown -R admin:admin /mnt
chown -R admin:admin /cy
cd /cy/server/
chown -R admin:admin elasticsearch-5.2.0
#测试
open http://localhost:9200/
curl http://localhost:9200/
#后台启动,不能用root用户启动
sh /cy/server/elasticsearch-5.2.0/bin/elasticsearch -d
nohup ./elasticsearch &
./elasticsearch -d
ps -ef |grep elas
#elasticsearch-head 监控安装
yum install git
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
yum install npm
npm config set registry https://registry.npm.taobao.org
npm install
nohup npm run start &
#测试
open http://localhost:9100/
如果不能连接
vim $ES_HOME$/config/elasticsearch.yml
# 增加如下字段
http.cors.enabled: true
http.cors.allow-origin: "*"
npm install 报错 [email protected] install: `node install.js`
初步诊断为包[email protected] install: `node install.js`下载失败
先运行 npm install [email protected] --ignore-script 可成功