您的位置:首页 > Web前端 > HTML5

elasticsearch5.x下载与启动

2017-01-05 14:45 155 查看

elasticsearch5.x下载与启动

下载

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.tar.gz

解压

tar -xzf elasticsearch-5.1.1.tar.gz

创建非ROOT用户,并授权

chown -R yt elasticsearch-5.1.1

修改配置elasticsearch.yml

network.host: 127.0.0.1,192.168.137.128

http.cors.enabled: true

http.cors.allow-origin: “*”

cluster.name: “yt-es”

启动es

/bin/elasticsearch

出现错误:

ERROR: bootstrap checks failed

max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

错误1:linux默认es操作文件句柄数太小

vi /etc/security/limits.conf

yt hard nofile 65536

yt soft nofile 65536

yt是es启动用户名,并用以下命令查看是否修改成功

ulimit -Hn

错误2:是操作系统的vm.max_map_count参数设置太小导致的,请使用root用户登录系统,执行以下命令:

sysctl -w vm.max_map_count=655360

并用以下命令查看是否修改成功

sysctl -a | grep “vm.max_map_count”

OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error=’Cannot allocate memory’ (errno=12)

这个错误是虚拟机分配es内存不足,因为是在测试搭建es,需要把内存有2g改小到512m,正式环境还需调整为更大数值。

vi es/config/jvm.options

/bin/elasticsearch

再次启动,重启访问正常。

集群安装

修改配置elasticsearch.yml

network.host: 127.0.0.1,192.168.137.128

http.port: 9200

transport.tcp.port: 9300

http.cors.enabled: true

http.cors.allow-origin: “*”

cluster.name: “yt-es”

node.master: true

node.data: true

http.enabled: true

discovery.zen.ping.unicast.hosts: [“192.168.137.128:9300”,”192.168.137.128:9301”,”192.168.137.128:9302”]

删除es下面因为启动生成的data文件,然后复制多份,修改为集群配置,启动集群。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  elasticsearch 教程