Centos7.2 安装Elasticsearch 6

吃着火锅唱着哥 等级 268 0 0

下载 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此时并不能访问。

Centos7.2 安装Elasticsearch 6

要访问主机的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访问。

 Centos7.2 安装Elasticsearch 6

这个时候可以在本机通过本机ip访问,还没有开防火墙,外网是不可以访问的。

https://www.helloworld.net/redirect?target=https://www.biaodianfu.com/centos-7-install-elasticsearch.html

https://www.helloworld.net/redirect?target=http://blog.csdn.net/sinat_29581293/article/details/53894033

https://www.helloworld.net/redirect?target=http://blog.csdn.net/lu_wei_wei/article/details/51263153

收藏
评论区
守株待兔
最新文章
Session原理 2021-03-14 22:09
什么是fine-tuning? 2021-03-13 17:21

导读