elasticsearch环境搭建的一些问题
2017-06-18 15:50
204 查看
elasticsearch必须用jdk1.8启动且,不能使用root账户启动。
因此新建用户:es,然后启动。
报错:
Exception in thread "main" SettingsException[Failed to load settings from /usr/local/elasticsearch/config/elasticsearch.yml]; nested: AccessDeniedException[/usr/local/elasticsearch/config/elasticsearch.yml];
将目录所有者换成启动elasticsearch的那个用户。 我这里用户为es
chown -R elasticsearch es:es
其他参考:http://www.cnblogs.com/sloveling/p/elasticsearch.html
elasticsearch 5.0 安装过程中遇到了一些问题,通过查找资料几乎都解决掉了,这里简单记录一下 ,供以后查阅参考,也希望可以帮助遇到同样问题的你。
问题一:警告提示
[2016-11-06T16:27:21,712][WARN ][o.e.b.JNANatives ] unable to install syscall filter:
java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in
at org.elasticsearch.bootstrap.Seccomp.linuxImpl(Seccomp.java:349) ~[elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.bootstrap.Seccomp.init(Seccomp.java:630) ~[elasticsearch-5.0.0.jar:5.0.0]
报了一大串错误,其实只是一个警告。
解决:使用心得linux版本,就不会出现此类问题了。
问题二:ERROR: bootstrap checks failed
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]
解决:切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
问题三:max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
解决:切换到root用户,进入limits.d目录下修改配置文件。
vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
* soft nproc 1024
#修改为
* soft nproc 2048
问题四:max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
解决:切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后,重新启动elasticsearch,即可启动成功。
如果没有生效,请重启服务器试试。
参考:http://blog.csdn.net/u012371450/article/details/51776505
修改访问elasticsearch的IP及端口
找到如下代码段,并取消network.host及http.port所在行的注释,修改IP及端口
2
3
4
5
6
7
8
9
10
11
12
直接运行bin/elasticsearch文件启动elasticsearch
2
启动时发现报错了。。。
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
于是我临时提高了vm.max_map_count的大小
*此操作需要root权限
查看修改结果
2
或者永久性修改
2
3
4
5
6
7
8
9
10
11
12
上面还有一个错误是关于jvm内存分配的问题heap size [268435456] not equal to maximum heap size [2147483648],需要修改的jvm配置
将-Xmx2g改成-Xmx256m,也就是heap size [268435456] /1024/1024的值
又有新的错误。。。
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
这个问题折腾了我一下午,最后还是找到了解决方案,同样回到config/elasticsearch.yml文件,找到如下配置,开放discovery.zen.ping.unicast.hosts及discovery.zen.minimum_master_nodes
2
3
4
5
6
7
8
9
10
11
12
13
然后修改max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]这个错误(切换到root操作)
2
3
4
5
修改后重新登录seven用户,使用如下命令查看是否修改成功
2
接下来就可以启动elasticsearch了,启动完成使用浏览器访问http://192.168.0.155:9200
ps:
没有使用集群 discovery.zen.minimum_master_nodes 不用打开。
因此新建用户:es,然后启动。
报错:
Exception in thread "main" SettingsException[Failed to load settings from /usr/local/elasticsearch/config/elasticsearch.yml]; nested: AccessDeniedException[/usr/local/elasticsearch/config/elasticsearch.yml];
将目录所有者换成启动elasticsearch的那个用户。 我这里用户为es
chown -R elasticsearch es:es
其他参考:http://www.cnblogs.com/sloveling/p/elasticsearch.html
Elasticsearch5.0 安装问题集锦
elasticsearch 5.0 安装过程中遇到了一些问题,通过查找资料几乎都解决掉了,这里简单记录一下 ,供以后查阅参考,也希望可以帮助遇到同样问题的你。问题一:警告提示
[2016-11-06T16:27:21,712][WARN ][o.e.b.JNANatives ] unable to install syscall filter:
java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in
at org.elasticsearch.bootstrap.Seccomp.linuxImpl(Seccomp.java:349) ~[elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.bootstrap.Seccomp.init(Seccomp.java:630) ~[elasticsearch-5.0.0.jar:5.0.0]
报了一大串错误,其实只是一个警告。
解决:使用心得linux版本,就不会出现此类问题了。
问题二:ERROR: bootstrap checks failed
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]
解决:切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
问题三:max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
解决:切换到root用户,进入limits.d目录下修改配置文件。
vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
* soft nproc 1024
#修改为
* soft nproc 2048
问题四:max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
解决:切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后,重新启动elasticsearch,即可启动成功。
如果没有生效,请重启服务器试试。
参考:http://blog.csdn.net/u012371450/article/details/51776505
修改访问elasticsearch的IP及端口
[seven@localhost config]$ vim /usr/java/elasticsearch/config/elasticsearch.yml1
找到如下代码段,并取消network.host及http.port所在行的注释,修改IP及端口
# ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # network.host: 192.168.0.155 # # Set a custom port for HTTP: # http.port: 9200 # # For more information, see the documentation at: # <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>1
2
3
4
5
6
7
8
9
10
11
12
直接运行bin/elasticsearch文件启动elasticsearch
[seven@localhost bin]$ cd /usr/java/elasticsearch/bin/ [seven@localhost bin]$ ./elasticsearch1
2
启动时发现报错了。。。
[seven@localhost bin]$ ./elasticsearch [2016-06-28 13:49:27,899][INFO ][node ] [Mondo] version[5.0.0-alpha3], pid[3671], build[cad959b/2016-05-26T08:25:57.564Z], OS[Linux/3.10.0-327.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1 .0_91/25.91-b14] ▽2016-06-28 13:49:27,900][INFO ][node ] [Mondo] initializing ... [2016-06-28 13:49:28,941][INFO ][plugins ] [Mondo] modules [percolator, lang-mustache, lang-painless, ingest-grok, reindex, lang-expression, lang-groovy], plugins [] [2016-06-28 13:49:28,963][INFO ][env ] [Mondo] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [15.7gb], net total_space [17.4gb], spins? [unknown], types [rootfs] [2016-06-28 13:49:28,963][INFO ][env ] [Mondo] heap size [1.9gb], compressed ordinary object pointers [true] [2016-06-28 13:49:31,980][INFO ][node ] [Mondo] initialized [2016-06-28 13:49:31,980][INFO ][node ] [Mondo] starting ... [2016-06-28 13:49:32,115][INFO ][transport ] [Mondo] publish_address {192.168.0.155:9300}, bound_addresses {192.168.0.155:9300} Exception in thread "main" java.lang.RuntimeException: bootstrap checks failed initial heap size [268435456] not equal to maximum heap size [2147483648]; this can cause resize pauses and prevents mlockall from locking the entire heap max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536] please set [discovery.zen.minimum_master_nodes] to a majority of the number of master eligible nodes in your cluster max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144] at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:125) at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:85) at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:65) at org.elasticsearch.bootstrap.Bootstrap$5.validateNodeBeforeAcceptingRequests(Bootstrap.java:183) at org.elasticsearch.node.Node.start(Node.java:337) at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:198) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:257) at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:96) at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:91) at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:91) at org.elasticsearch.cli.Command.main(Command.java:53) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:70) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:63) Refer to the log for complete error details. [2016-06-28 13:49:32,144][INFO ][node ] [Mondo] stopping ... [2016-06-28 13:49:32,198][INFO ][node ] [Mondo] stopped [2016-06-28 13:49:32,198][INFO ][node ] [Mondo] closing ... [2016-06-28 13:49:32,210][INFO ][node ] [Mondo] closed1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
于是我临时提高了vm.max_map_count的大小
*此操作需要root权限
[root@localhost ~]# sysctl -w vm.max_map_count=2621441
查看修改结果
[root@localhost ~]# sysctl -a|grep vm.max_map_count vm.max_map_count = 2621441
2
或者永久性修改
[root@localhost ~]# cat /etc/sysctl.conf | grep -v "vm.max_map_count" > /tmp/system_sysctl.conf [root@localhost ~]# echo "vm.max_map_count=262144" >> /tmp/system_sysctl.conf [root@localhost ~]# mv /tmp/system_sysctl.conf /etc/sysctl.conf mv:是否覆盖"/etc/sysctl.conf"? y [root@localhost ~]# cat /etc/sysctl.conf # System default settings live in /usr/lib/sysctl.d/00-system.conf. # To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file # # For more information, see sysctl.conf(5) and sysctl.d(5). vm.max_map_count=262144 [root@localhost ~]# sysctl -p vm.max_map_count = 2621441
2
3
4
5
6
7
8
9
10
11
12
上面还有一个错误是关于jvm内存分配的问题heap size [268435456] not equal to maximum heap size [2147483648],需要修改的jvm配置
[seven@localhost bin]$ vim /usr/java/elasticsearch/config/jvm.options1
将-Xmx2g改成-Xmx256m,也就是heap size [268435456] /1024/1024的值
又有新的错误。。。
Exception in thread "main" java.lang.RuntimeException: bootstrap checks failed initial heap size [268435456] not equal to maximum heap size [2147483648]; this can cause resize pauses and prevents mlockall from locking the entire heap max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536] memory locking requested for elasticsearch process but memory is not locked at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:125) at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:85) at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:65) at org.elasticsearch.bootstrap.Bootstrap$5.validateNodeBeforeAcceptingRequests(Bootstrap.java:183) at org.elasticsearch.node.Node.start(Node.java:337) at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:198) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:257) at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:96) at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:91) at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:91) at org.elasticsearch.cli.Command.main(Command.java:53) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:70) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:63) Refer to the log for complete error details. [2016-06-28 14:55:49,770][INFO ][node ] [Goldbug] stopping ... [2016-06-28 14:55:49,875][INFO ][node ] [Goldbug] stopped [2016-06-28 14:55:49,875][INFO ][node ] [Goldbug] closing ... [2016-06-28 14:55:49,887][INFO ][node ] [Goldbug] closed1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
这个问题折腾了我一下午,最后还是找到了解决方案,同样回到config/elasticsearch.yml文件,找到如下配置,开放discovery.zen.ping.unicast.hosts及discovery.zen.minimum_master_nodes
# --------------------------------- Discovery ---------------------------------- # # Pass an initial list of hosts to perform discovery when new node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # discovery.zen.ping.unicast.hosts: ["192.168.0.155"] # # Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1): # discovery.zen.minimum_master_nodes: 3 # # For more information, see the documentation at: # <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>1
2
3
4
5
6
7
8
9
10
11
12
13
然后修改max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]这个错误(切换到root操作)
[root@localhost ~]# cp /etc/security/limits.conf /etc/security/limits.conf.bak [root@localhost ~]# cat /etc/security/limits.conf | grep -v "seven" > /tmp/system_limits.conf [root@localhost ~]# echo "seven hard nofile 65536" >> /tmp/system_limits.conf [root@localhost ~]# echo "seven soft nofile 65536" >> /tmp/system_limits.conf [root@localhost ~]# mv /tmp/system_limits.conf /etc/security/limits.conf1
2
3
4
5
修改后重新登录seven用户,使用如下命令查看是否修改成功
[seven@localhost ~]$ ulimit -Hn 655361
2
接下来就可以启动elasticsearch了,启动完成使用浏览器访问http://192.168.0.155:9200
{ "name" : "Vampire by Night", "cluster_name" : "elasticsearch", "version" : { "number" : "5.0.0-alpha3", "build_hash" : "cad959b", "build_date" : "2016-05-26T08:25:57.564Z", "build_snapshot" : false, "lucene_version" : "6.0.0" }, "tagline" : "You Know, for Search" }
ps:
没有使用集群 discovery.zen.minimum_master_nodes 不用打开。
相关文章推荐
- [android之旅]环境搭建中的一些问题
- 1.1 linux下mpi开发环境搭建流程及过程中出现的一些问题解决方法。
- 整理下ubuntu系统下用symfony新建web项目的环境搭建以及一些问题
- Crm项目中的环境搭建和一些细节问题
- intellij idea 搭建scala环境和一些问题
- Eclipse下搭建Android开发环境遇到的一些问题及解决
- 俺网站Android及Ophone开发,全系列上手资料,关于环境搭建遇见的一些问题,包1天能上手。
- windows 2008 r2 下面搭建 iis+sql server +php5.6 环境遇见的一些问题记录一下
- spring3+struts2环境搭建中遇到的一些问题
- 《Metasploit魔鬼训练营》虚拟环境搭建中网络配置的一些问题
- 生产环境使用elasticsearch遇到的一些问题以及解决方法(不断更新)
- linux环境搭建的一些问题
- 手动搭建ssh环境出现的一些问题
- 【转】在ubuntu环境下搭建svn server遇到的一些问题
- 生产环境使用elasticsearch遇到的一些问题以及解决方法(不断更新)
- 在ubuntu环境下搭建svn server遇到的一些问题
- Android开发环境搭建一些注意问题
- 生产环境使用elasticsearch遇到的一些问题以及解决方法
- linux系统环境搭建遇到的一些问题
- 生产环境使用elasticsearch遇到的一些问题以及解决方法(不断更新)