Centos7.2 安裝Elasticsearch 6


下載 elasticsearch.6.0.0.tar.gz

遷移文件到usr/local中

mv elasticsearch-6.0.0.tar.gz /usr/local/
cd /usr/local
tar zxvf elasticsearch-6.0.0.tar.gz 

修改elasticsearch6.0.0文件夾的權限,es 規定 root 用戶不能啟動 es,所以需要使用一個其他用戶來啟動 es

[hongdada@localhost elasticsearch]$ ll
總用量 27368
drwxr-xr-x. 10 hongdada hongdada     4096 11月 23 22:31 elasticsearch-6.0.0
-rwxrw-rw-.  1 root     root     28017602 11月 21 22:49 elasticsearch-6.0.0.tar.gz
[hongdada@localhost elasticsearch]$ chown -R root: elasticsearch-6.0.0
chown: 正在更改"elasticsearch-6.0.0/lib/elasticsearch-6.0.0.jar" 的所有者: 不允許的操作
........
chown: 正在更改"elasticsearch-6.0.0" 的所有者: 不允許的操作
[hongdada@localhost elasticsearch]$ ll
總用量 27368
drwxr-xr-x. 10 hongdada hongdada     4096 11月 23 22:31 elasticsearch-6.0.0
-rwxrw-rw-.  1 root     root     28017602 11月 21 22:49 elasticsearch-6.0.0.tar.gz
[hongdada@localhost elasticsearch]$ su
密碼:
[root@localhost elasticsearch]# chown -R root: elasticsearch-6.0.0
[root@localhost elasticsearch]# ll
總用量 27368
drwxr-xr-x. 10 root root     4096 11月 23 22:31 elasticsearch-6.0.0
-rwxrw-rw-.  1 root root 28017602 11月 21 22:49 elasticsearch-6.0.0.tar.gz
[root@localhost elasticsearch]# chown -R hongdada:hongdada elasticsearch-6.0.0
[root@localhost elasticsearch]# ll
總用量 27368
drwxr-xr-x. 10 hongdada hongdada     4096 11月 23 22:31 elasticsearch-6.0.0
-rwxrw-rw-.  1 root     root     28017602 11月 21 22:49 elasticsearch-6.0.0.tar.gz

 因為本來已經設置好了,為了copy命令重新改了權限

 現在就可以訪問本地的,但是該主機的ip192.168.1.108此時並不能訪問。

要訪問主機的ip,需要修改config/elasticsearch.yml文件

network.host: 0.0.0.0

取消network.host前面的注釋#,並修改ip為0.0.0.0,或者本機的外網ip192.168.1.108都可以,但是0.0.0.0適用范圍廣。

修改配置以后要重啟es,但是es的重啟還有點煩,要先殺死es進程關閉,然后再次啟動

重啟:

[hongdada@localhost elasticsearch-6.0.0]$ cd bin
[hongdada@localhost bin]$ ps -ef |grep elastic
hongdada   6457   6411  0 22:41 pts/0    00:00:00 grep --color=auto elastic
[hongdada@localhost bin]$ ps -ef |grep elasticsearch
hongdada   6473   6411  0 22:41 pts/0    00:00:00 grep --color=auto elasticsearch
[hongdada@localhost bin]$ sh elasticsearch -d
[hongdada@localhost bin]$ ps -ef |grep elastic
hongdada   6514      1 99 22:41 pts/0    00:00:13 /usr/local/jdk/jdk1.8.0_121/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/usr/local/elasticsearch/elasticsearch-6.0.0 -Des.path.conf=/usr/local/elasticsearch/elasticsearch-6.0.0/config -cp /usr/local/elasticsearch/elasticsearch-6.0.0/lib/* org.elasticsearch.bootstrap.Elasticsearch -d
hongdada   6586   6411  0 22:41 pts/0    00:00:00 grep --color=auto elastic
[hongdada@localhost bin]$ 

kill:

kill -9 6514

再次啟動:

sh elasticsearch -d

 

安裝過程中的異常:

[hongdada@localhost bin]$ sh elasticsearch 
[2017-11-23T23:25:41,142][INFO ][o.e.n.Node               ] [] initializing ...
[2017-11-23T23:25:41,203][INFO ][o.e.e.NodeEnvironment    ] [l2KjKQB] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [28.4gb], net total_space [35.5gb], types [rootfs]
[2017-11-23T23:25:41,204][INFO ][o.e.e.NodeEnvironment    ] [l2KjKQB] heap size [989.8mb], compressed ordinary object pointers [true]
[2017-11-23T23:25:41,205][INFO ][o.e.n.Node               ] node name [l2KjKQB] derived from node ID [l2KjKQBBSRacQ3kzNB2Qgg]; set [node.name] to override
[2017-11-23T23:25:41,205][INFO ][o.e.n.Node               ] version[6.0.0], pid[9359], build[8f0685b/2017-11-10T18:41:22.859Z], OS[Linux/3.10.0-514.26.2.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_121/25.121-b13]
[2017-11-23T23:25:41,205][INFO ][o.e.n.Node               ] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/usr/local/elasticsearch/elasticsearch-6.0.0, -Des.path.conf=/usr/local/elasticsearch/elasticsearch-6.0.0/config]
[2017-11-23T23:25:41,852][INFO ][o.e.p.PluginsService     ] [l2KjKQB] loaded module [aggs-matrix-stats]
[2017-11-23T23:25:41,853][INFO ][o.e.p.PluginsService     ] [l2KjKQB] loaded module [analysis-common]
[2017-11-23T23:25:41,853][INFO ][o.e.p.PluginsService     ] [l2KjKQB] loaded module [ingest-common]
[2017-11-23T23:25:41,853][INFO ][o.e.p.PluginsService     ] [l2KjKQB] loaded module [lang-expression]
[2017-11-23T23:25:41,853][INFO ][o.e.p.PluginsService     ] [l2KjKQB] loaded module [lang-mustache]
[2017-11-23T23:25:41,853][INFO ][o.e.p.PluginsService     ] [l2KjKQB] loaded module [lang-painless]
[2017-11-23T23:25:41,853][INFO ][o.e.p.PluginsService     ] [l2KjKQB] loaded module [parent-join]
[2017-11-23T23:25:41,853][INFO ][o.e.p.PluginsService     ] [l2KjKQB] loaded module [percolator]
[2017-11-23T23:25:41,853][INFO ][o.e.p.PluginsService     ] [l2KjKQB] loaded module [reindex]
[2017-11-23T23:25:41,854][INFO ][o.e.p.PluginsService     ] [l2KjKQB] loaded module [repository-url]
[2017-11-23T23:25:41,854][INFO ][o.e.p.PluginsService     ] [l2KjKQB] loaded module [transport-netty4]
[2017-11-23T23:25:41,854][INFO ][o.e.p.PluginsService     ] [l2KjKQB] loaded module [tribe]
[2017-11-23T23:25:41,854][INFO ][o.e.p.PluginsService     ] [l2KjKQB] no plugins loaded
[2017-11-23T23:25:42,794][INFO ][o.e.d.DiscoveryModule    ] [l2KjKQB] using discovery type [zen]
[2017-11-23T23:25:43,151][INFO ][o.e.n.Node               ] initialized
[2017-11-23T23:25:43,151][INFO ][o.e.n.Node               ] [l2KjKQB] starting ...
[2017-11-23T23:25:43,245][INFO ][o.e.t.TransportService   ] [l2KjKQB] publish_address {192.168.1.108:9300}, bound_addresses {[::]:9300}
[2017-11-23T23:25:43,253][INFO ][o.e.b.BootstrapChecks    ] [l2KjKQB] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2017-11-23T23:25:43,258][INFO ][o.e.n.Node               ] [l2KjKQB] stopping ...
[2017-11-23T23:25:43,308][INFO ][o.e.n.Node               ] [l2KjKQB] stopped
[2017-11-23T23:25:43,308][INFO ][o.e.n.Node               ] [l2KjKQB] closing ...
[2017-11-23T23:25:43,314][INFO ][o.e.n.Node               ] [l2KjKQB] closed

這里面很明顯的有兩個參數的值太小

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

修改/etc/security/limits.conf文件,添加或修改如下行:

*        hard    nofile           65536
*        soft    nofile           65536

2.max virtual memory areas vm.max......

修改 /etc/sysctl.conf 文件,添加如下行:

vm.max_map_count=262144

修改好了以后,調用sysctl -a查看,發現參數並沒有變動,要重啟才可以。

重啟以后,再啟動es即可,就可以通過主機ip訪問。

 

這個時候可以在本機通過本機ip訪問,還沒有開防火牆,外網是不可以訪問的。

 

https://www.biaodianfu.com/centos-7-install-elasticsearch.html

http://blog.csdn.net/sinat_29581293/article/details/53894033

http://blog.csdn.net/lu_wei_wei/article/details/51263153

http://blog.csdn.net/kongxx/article/details/52993057

http://blog.csdn.net/Gamer_gyt/article/details/52960941


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM