Es环境搭建

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 报错 phantomjs-prebuilt@2.1.14 install: `node install.js`
初步诊断为包phantomjs-prebuilt@2.1.14 install: `node install.js`下载失败

先运行 npm install phantomjs-prebuilt@2.1.14 --ignore-script 可成功

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值