Centos7.2 安裝Elasticsearch 6

下載 elasticsearch.6.0.0.tar.gzhtml

遷移文件到usr/local中java

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,因此須要使用一個其餘用戶來啓動 esnode

[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命令從新改了權限express

 如今就能夠訪問本地的,可是該主機的ip192.168.1.108此時並不能訪問。bootstrap

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

network.host: 0.0.0.0

取消network.host前面的註釋#,並修改ip爲0.0.0.0,或者本機的外網ip192.168.1.108均可以,可是0.0.0.0適用範圍廣。less

修改配置之後要重啓es,可是es的重啓還有點煩,要先殺死es進程關閉,而後再次啓動elasticsearch

重啓:ide

[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:oop

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

相關文章
相關標籤/搜索