ScottWei007 / hello-world

new comer
0 stars 0 forks source link

在centos7 安装elasticsearch #4

Open ScottWei007 opened 7 years ago

ScottWei007 commented 7 years ago

注意:不能使用root角色启动elasticsearch

  1. 下载: sudo wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.1.tar.gz

  2. 比较 SHA: sudo sha1sum elasticsearch-5.4.1.tar.gz

  3. 解压: sudo tar -xzf elasticsearch-5.4.1.tar.gz

  4. 进入目录: cd elasticsearch-5.4.1

  5. 给目录权限: sudo chown q2872869434 /usr/elasticsearch/elasticsearch-5.4.1 -R

  6. 修改java内存(elasticsearch默认2g): sudo vi elasticsearch-5.4.1/config/jvm.options

  7. 设置软连接(elasticsearch找不到java): sudo ln -s /usr/java/jdk1.8.0_131/bin/java /usr/bin/java

  8. 运行(不能用root角色)后端进程: ./bin/elasticsearch -d -p pid

  9. 测试,有json字符串说明ok : curl 'http://localhost:9200/?pretty'

  10. 关闭: kill cat pid

  11. 外部连接 添加elasticsearch.yml中的: network.bind_host:0.0.0.0

12.. nofile大小不够添加 /etc/security/limits.conf中的: q2872869434- nofile 65536

  1. 也可以临时添加: ulimit -n 65536

https://gryzli.info/2018/03/30/elasticsearch-installation-how-to/