elasticsearch不能以root运行的问题
来源:互联网 发布:sas软件编辑器推荐 编辑:程序博客网 时间:2024/05/06 03:55
当我们在使用elasticsearch的时候,如果是以root权限来执行elasticsearch
./elasticsearch
- 1
则会有以下报错
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root. at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:94) at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:160) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)Refer to the log for complete error details.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
这是出于系统安全考虑设置的条件。由于ElasticSearch可以接收用户输入的脚本并且执行,为了系统安全考虑,
建议创建一个单独的用户用来运行ElasticSearch
创建elsearch用户组及elsearch用户
groupadd elsearchuseradd elsearch -g elsearch -p elasticsearch #useradd [user name] -g [group name] -p [password]
- 1
- 2
更改elasticsearch文件夹及内部文件的所属用户及组为elsearch:elsearch
chown -R elsearch:elsearch elasticsearch #chown -R [user name:group name] 该用户所分配有权限的目录
- 1
elasticsearch
为你elasticsearch的目录名称
切换到elsearch用户再启动
su elsearch #切换账户cd elasticsearch/bin #进入你的elasticsearch目录下的bin目录./elasticsearch
- 1
- 2
- 3
启动后会打印正常启动日志信息如下
[elsearch@localhost elasticsearch-2.4.0]$ ./bin/elasticsearch [2016-11-30 09:00:07,658][INFO ][node ] [Black Bolt] version[2.4.0], pid[25504], build[ce9f0c7/2016-08-29T09:14:17Z][2016-11-30 09:00:07,674][INFO ][node ] [Black Bolt] initializing ...[2016-11-30 09:00:08,248][INFO ][plugins ] [Black Bolt] modules [lang-groovy, reindex, lang-expression], plugins [elasticsearch-analysis-ik, head], sites [head][2016-11-30 09:00:08,267][INFO ][env ] [Black Bolt] using [1] data paths, mounts [[/home (/dev/mapper/centos-home)]], net usable_space [172.1gb], net total_space [172.9gb], spins? [possibly], types [xfs][2016-11-30 09:00:08,267][INFO ][env ] [Black Bolt] heap size [990.7mb], compressed ordinary object pointers [true][2016-11-30 09:00:08,268][WARN ][env ] [Black Bolt] max file descriptors [4096] for elasticsearch process likely too low, consider increasing to at least [65536][2016-11-30 09:00:09,561][INFO ][ik-analyzer ] [Dict Loading] ik/custom/mydict.dic[2016-11-30 09:00:09,579][INFO ][ik-analyzer ] [Dict Loading] ik/custom/single_word_low_freq.dic[2016-11-30 09:00:09,589][INFO ][ik-analyzer ] [Dict Loading] ik/custom/ext_stopword.dic[2016-11-30 09:00:09,935][INFO ][node ] [Black Bolt] initialized[2016-11-30 09:00:09,935][INFO ][node ] [Black Bolt] starting ...[2016-11-30 09:00:09,975][INFO ][transport ] [Black Bolt] publish_address {172.17.0.1:9300}, bound_addresses {[::]:9300}[2016-11-30 09:00:09,979][INFO ][discovery ] [Black Bolt] elasticsearch/YGWbxIWSRyejtiM4WqHwAA[2016-11-30 09:00:13,003][INFO ][cluster.service ] [Black Bolt] new_master {Black Bolt}{YGWbxIWSRyejtiM4WqHwAA}{172.17.0.1}{172.17.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)[2016-11-30 09:00:13,010][INFO ][http ] [Black Bolt] publish_address {172.17.0.1:9200}, bound_addresses {[::]:9200}[2016-11-30 09:00:13,010][INFO ][node ] [Black Bolt] started[2016-11-30 09:00:13,323][INFO ][gateway ] [Black Bolt] recovered [1] indices into cluster_state[2016-11-30 09:00:15,576][INFO ][cluster.routing.allocation] [Black Bolt] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[sports][2]] ...]).
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
之后如果再启动的话(如果是以root权限登录服务器),只需要执行切换账户,然后运行elasticsearch就可以了
su elsearch #切换账户cd elasticsearch/bin #进入你的elasticsearch目录下的bin目录./elasticsearch
- 1
- 2
- 3
ElasticSearch后台启动命令
./elasticsearch -d
- 1
查看后台命令是否启动成功
ps aux|grep elasticsearch
- 1
结果
elsearch 3119 4.6 3.2 3535488 250876 pts/1 Sl 16:50 0:09 /opt/java/jdk1.7.0_75/bin/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.nosys=true -Des.path.home=/home/py-project/elasticsearc-2.4.0 -cp /home/py-project/elasticsearch-2.4.0/lib/elasticsearch-2.4.0.jar:/home/py-project/elasticsearch-2.4.0/lib/* org.elasticsearch.bootstrap.Elasticsearch start -delsearch 3254 0.0 0.0 110224 916 pts/1 S+ 16:54 0:00 grep --color=auto elasticsearch
阅读全文
0 0
- elasticsearch不能以root运行的问题
- elasticsearch不能以root运行的问题
- 解决fedora16不能以root用户运行google chrome浏览器的问题
- 解决Chromium 不能以 root 身份运行
- 解决Chromium 不能以 root 身份运行
- elasticsearch 不能root启动
- 关于ubuntu下 chrom 不能以 root 身份 运行的 解决方案
- ElasticSearch Root身份运行
- Chrome默认不能以root身份运行 Google Chrome 浏览器
- adb 以root来运行
- linux 以root运行可执行文件
- Google Chrome can not be run as root 【不能以根用户身份运行 Google Chrome】
- Backtrack5 R3 下安装chrome 不能以root权限运行解决方法
- ubuntu14.04下Google Chrome浏览器不能以root用户身份运行解决
- ubuntu12.04下Google Chrome浏览器不能以root用户身份运行解决方案
- ubuntu Google Chrome浏览器不能以root用户身份运行解决方案
- 以root权限运行自己所编译程序的方法
- 配置Tomcat以指定的身份(非root)运行
- Apache POI
- 微信小程序实战:厕所雷达
- mac下* daemon not running.starting it now on port 5037 * 问题解决
- unity shader—高斯模糊效果
- spring核心类之DefaultListableBeanFactory
- elasticsearch不能以root运行的问题
- char** argv与char *argv[]区别
- neo4j配置
- Spring MVC 上传图片(文件接收方式)
- 【Python】Python简单入门
- 利用linux的mtrace命令定位内存泄露(Memory Leak)
- INPUT 系统log Android7.1.2
- 如何检测、清理Greenplum膨胀、垃圾
- Laravel-admin的点点滴滴-使用composer生成后端控制器