1. 程式人生 > >centos7 安裝elasticsearch6.4

centos7 安裝elasticsearch6.4

注意elasticsearch 不能root使用者啟動

所以在整個安裝過程中使用普通使用者

1 .建立普通使用者

2 .在普通使用者目錄下實現叢集間免密登入

[[email protected] ~]$ ssh-keygen

所有的問題都用enter鍵

[[email protected] ~]$ cd .ssh/
[[email protected] .ssh]$ scp id_rsa.pub [email protected]:/home/yao/.ssh/id_rsa.pub.hadoop1

[[email protected] .ssh]$ scp id_rsa.pub

[email protected]:/home/yao/.ssh/id_rsa.pub.hadoop1
在hadoop2 hadoop3中分別修改:

[[email protected] .ssh]$ touch authorized_keys 
[[email protected] .ssh]$ chmod 600 authorized_keys
[[email protected] .ssh]$ cat id_rsa.pub.hadoop1 >> authorized_keys 

在hadoop1中登入hadoop2,hadoop3驗證。

[[email protected] .ssh]$ ssh [email protected]

免密登入成功

3 . 普通使用者下安裝jdk 

4 .安裝elasticsearch6.4 

[[email protected] ~]$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.0.tar.gz
[[email protected] ~]$ tar -zxvf elasticsearch-6.4.0.tar.gz 

[[email protected] ~]$ cd elasticsearch-6.4.0/

[[email protected] elasticsearch-6.4.0]$ vim config/elasticsearch.yml 

cluster.name: es
node.name: node3
node.master: true
node.data: true
path.data: /home/yao/elasticsearch-6.4.0/data
path.logs: /home/yao/elasticsearch-6.4.0/logs
network.host: 192.168.1.62
transport.tcp.port: 9300
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.1.60:9300","192.168.1.61:9300","192.168.1.63:9300"]

[[email protected] bin]# ./elasticsearch &

5.關閉防火牆,使瀏覽器可訪問

[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# systemctl disabled firewalld
 

6. 瀏覽器檢視是否安裝成功

192.168.1.60:9200

192.168.1.61:9200

192.168.1.62:9200:

出現問題:

問題 1 :
[2018-09-05T10:42:56,077][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

異常原因: 不能以root許可權執行Elasticsearch 

解決辦法: 

(1)執行時加上引數: bin/elasticsearch -Des.insecure.allow.root=true

(2)修改bin/elasticsearch檔案:  ES_JAVA_OPTS="-Des.insecure.allow.root=true"

從新啟動Elasticsearch 

問題2: 

參考: https://blog.csdn.net/feinifi/article/details/73633235?utm_source=itdadao&utm_medium=referral

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]

問題原因: 所給的檔案空間太小,需要增大 虛擬記憶體空間太小,需要增大

解決辦法:

[[email protected] logs]# vim /etc/security/limits.conf 

yao hard nofile 65536

yao soft nofile 65536
[[email protected] ~]$ ulimit -Hn
65536
[[email protected] yao]# vim /etc/sysctl.conf 

vm.max_map_count=655360
[[email protected] yao]# sysctl -p
vm.max_map_count = 655360
問題解決


參考: https://blog.csdn.net/napoay/article/details/53237471