如何使用root账户启动elasticsearch 启动慢5.2.2

Elasticsearch(6)
本文未使用这个方法,而是新建了一个es账户,把es文件夹的权限赋值给这个账户,然后用它启动es。
如果以root身份运行将会出现以下问题
root@yxjay:/opt/elasticsearch-2.3.5/bin# ./elasticsearch
Exception in thread “main” Java.lang.RuntimeException: don’t run elasticsearch as root.
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.Java:93)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
解决方法1:
在执行elasticSearch时加上参数-Des.insecure.allow.root=true,完整命令如下
./elasticsearch -Des.insecure.allow.root=true
解决办法2:
用vi打开elasicsearch执行文件,在变量ES_JAVA_OPTS使用前添加以下命令
ES_JAVA_OPTS="-Des.insecure.allow.root=true"你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
一、★★★★★★★单机版安装及环境配置★★★★★★★
安装环境 CentOS release 6.7 (Final)
1、因Elasticsearch是基于Java写的,所以它的运行环境中需要java的支持,在Linux下执行命令:
java -version,检查Jar包是否安装
安装java版本至少是1.8以上
2、首先准备下载Elasticsearch5.5.0 安装包
3、下载到/usr/openv 目录下,解压
elasticsearch-5.5.0.tar.gz
4、因为Elasticsearch5.0之后,不能使用root账户启动,我们先创建一个esuser组和账户
esuser -g esuser -p esuser
5.更改文件夹权限
chown -R esuser:esuser /usr/openv/elasticsearch-5.5.0
6、启动elasticsearch:
/usr/openv/elasticsearch-5.5.0/bin
./elasticsearch
(前台启动)
这时候我们看见下面的提示,说明就成功了:
[elasticsearch@vmlnx-sma bin]$ ./elasticsearch
[T21:43:21,185][INFO ][o.e.n.Node
] [] initializing ...
[T21:43:21,264][INFO ][o.e.e.NodeEnvironment
] [uY3prpy] using [1] data paths, mounts [[/ (/dev/mapper/VolGroup-lv_root)]], net usable_space [43.5gb], net total_space [54.6gb], spins? [possibly], types [ext4]
[T21:43:21,265][INFO ][o.e.e.NodeEnvironment
] [uY3prpy] heap size [1.9gb], compressed ordinary object pointers [true]
[T21:43:21,268][INFO ][o.e.n.Node
] node name [uY3prpy] derived from node ID [uY3prpyqTHim5twauiVWhQ]; set [node.name] to override
[T21:43:21,271][INFO ][o.e.n.Node
] version[5.2.2], pid[5602], build[f9d9b74/T17:26:45.835Z], OS[Linux/3.10.5-3.el6.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_121/25.121-b13]
[T21:43:22,226][INFO ][o.e.p.PluginsService
] [uY3prpy] loaded module [aggs-matrix-stats]
[T21:43:22,226][INFO ][o.e.p.PluginsService
] [uY3prpy] loaded module [ingest-common]
[T21:43:22,226][INFO ][o.e.p.PluginsService
] [uY3prpy] loaded module [lang-expression]
[T21:43:22,227][INFO ][o.e.p.PluginsService
] [uY3prpy] loaded module [lang-groovy]
[T21:43:22,227][INFO ][o.e.p.PluginsService
] [uY3prpy] loaded module [lang-mustache]
[T21:43:22,227][INFO ][o.e.p.PluginsService
] [uY3prpy] loaded module [lang-painless]
[T21:43:22,228][INFO ][o.e.p.PluginsService
] [uY3prpy] loaded module [percolator]
[T21:43:22,228][INFO ][o.e.p.PluginsService
] [uY3prpy] loaded module [reindex]
[T21:43:22,228][INFO ][o.e.p.PluginsService
] [uY3prpy] loaded module [transport-netty3]
[T21:43:22,229][INFO ][o.e.p.PluginsService
] [uY3prpy] loaded module [transport-netty4]
[T21:43:22,230][INFO ][o.e.p.PluginsService
] [uY3prpy] no plugins loaded
[T21:43:24,689][INFO ][o.e.n.Node
] initialized
[T21:43:24,689][INFO ][o.e.n.Node
] [uY3prpy] starting ...
[T21:43:24,929][INFO ][o.e.t.TransportService
] [uY3prpy] publish_address {10.245.250.65:9300}, bound_addresses {10.245.250.65:9300}
[T21:43:24,948][INFO ][o.e.b.BootstrapChecks
] [uY3prpy] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[T21:43:28,010][INFO ][o.e.c.s.ClusterService
] [uY3prpy] new_master {uY3prpy}{uY3prpyqTHim5twauiVWhQ}{AqALBH68RCucWcPmHCE6dw}{10.245.250.65}{10.245.250.65:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[T21:43:28,034][INFO ][o.e.h.HttpServer
] [uY3prpy] publish_address {10.245.250.65:9200}, bound_addresses {10.245.250.65:9200}
[T21:43:28,034][INFO ][o.e.n.Node
] [uY3prpy] started
[T21:43:28,061][INFO ][o.e.g.GatewayService
] [uY3prpy] recovered [0] indices into cluster_state
./elasticsearch -d (后台启动)
打开另一个终端进行测试:
curl 'http://localhost:9200/?pretty'
你能看到以下返回信息:
&status&: 200,
&name&: &Shrunken Bones&,
&version&: {
&number&: &1.4.0&,
&lucene_version&: &4.10&
&tagline&: &You Know, for Search&
说明安装成功。
但是我们希望能够使用ip访问,那么还需要设置相关内容
跳转到Elasticsearch的config配置文件下,使用vim打开elasticsearch.yml,找到里面的&network.host&,将其改为本机IP,保存。
cd elasticsearch/config/
vim elasticsearch.yml
重启ElasticSearch,然后使用访问。
二、★★★★★★★常见错误★★★★★★★
问题一:警告提示
[T16: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
并执行命令:
然后,重新启动elasticsearch,即可启动成功。
三、★★★★★★★★★★★★★★★★★★★
查看集群健康状态:curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'
查看本地节点信息:curl -XGET
其它一些命令:
查看集群状态:curl -XGET
curl -XGET 'http://localhost:9200/_cluster/state?pretty'
curl -XGET 'http://localhost:9200/_cluster/stats?human&pretty'
查看集群节点:curl -XGET
curl -XGET 'http://localhost:9200/_nodes/stats?pretty'
curl -XGET 'http://localhost:9200/_nodes/stats/os,process?pretty'
查询索引列表:curl -XGET
创建索引:curl -XPUT
查询索引:curl -XGET
删除索引:curl -XDELETE
停服与重启
停止ES服务器
如果是前台启动,直接Ctrl+Z或者直接关掉命令行窗口,则服务器立即停止。
如果是通过后台启动的ES服务,则需要用如下命令停止服务器:
也可以直接在Window系统的服务列表中找到安装的服务,然后右键停止。
另外,还可以通过curl工具来关掉整个集群或者集群中的指定节点,命令如下:
关掉集群:curl -XPOST 。
关掉指定的节点,节点标识符为jMJhGirhSRa9Iw2fQtjJ5A:curl -XPOST 。
重启ES服务器
如果是想再次重启已经启动的ES服务,可以在Window系统的服务列表中找到安装的服务,然后右键重新启动即可。
楼主你好,我参照这你的方法把elasticsearch.yml里的network.host改为了本机ip但是重启es后报错,信息如下
org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to []]; nested: BindException[无法指定被请求的地址];
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.5.2.jar:5.5.2]
Caused by: org.elasticsearch.transport.BindTransportException: Failed to bind to []
at org.elasticsearch.transport.TcpTransport.bindToPort(TcpTransport.java:793) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.transport.TcpTransport.bindServer(TcpTransport.java:758) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.transport.netty4.Netty4Transport.doStart(Netty4Transport.java:173) ~[?:?]
我的配置文件中的内容都是注释过的我自己在里边加了network.host,是不是我加的有问题,还是我本机ip填的有问题,我IP取得是inet 后边的,我用的lnuix版本是 CentOS 7,es版本是5.5.2
要回复文章请先或他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)Elasticsearch5.x部署遇到的问题汇总 - 简书
Elasticsearch5.x部署遇到的问题汇总
欢迎访问我的博客查看原文:
can not run elasticsearch as root
不能以root用户启动ES服务器
非要以root用户运行,对于5.X,在config/jvm.options配置文件中,添加
-Des.insecure.allow.root=true
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
最大虚拟内存太小
切换到root用户
vi /etc/sysctl.conf
添加内容:vm.max_map_count=655360
执行命令:sysctl -p
max number of threads [1024] for user [xxx] likely too low, increase to at least [2048]
无法创建本地线程问题,用户最大可创建线程数太小
切换到root用户
vi /etc/security/limits.d/90-nproc.conf
找到如下内容:
* soft nproc 1024
* soft nproc 2048
保存、退出、重新登录才可生效
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
无法创建本地文件问题,用户最大可创建文件数太小
解决方案:
切换到root用户
vi /etc/security/limits.conf
添加如下内容:
soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
*表示所有用户
保存、退出、重新登录才可生效
system call filte check the logs and fix your configuration or disable system call filters at your own risk
这是在因为操作系统不支持SecComp,而ES5.2.2默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
[T16:27:21,712][WARN ][o.e.b.JNANatives ] unable to install syscall filter:
Java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMPandCONFIG_SECCOMP_FILTERcompiledinatorg.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版本过低造成的。
1、重新安装新版本的Linux系统
2、警告不影响使用,可以忽略
org.elasticsearch.transport.RemoteTransportException: Failed to deserialize exception response from stream
ElasticSearch节点之间的jdk版本不一致
解决方案:
ElasticSearch集群统一jdk环境
Unsupported major.minor version 52.0
jdk版本问题太低
解决方案:
更换jdk版本,ElasticSearch5.0.0支持jdk1.8.0
欢迎关注我的微信订阅号:
欢迎关注我的开发者头条独家号搜索:269166
专注于Java 后端框架 分布式 中间件 搜索引擎等技术分享,欢迎访问下方我的独立博客和关注微信订阅号。
Why Stock Markets CrashThis page intentionally left blankWhy Stock Markets CrashCritical Events in ComplexFinancial SystemsD i d i e r S ...
ElasticSearch 5 安装部署常见错误或问题 问题1: uncaught exception in thread [main]org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeExcept...
一、Elasticsearch 简介 下面摘自官网 Elasticsearch is a distributed, RESTful search and analytics engine capable of solving a growing number of use ...
问题一: [T16:27:21,712][WARN ][o.e.b.JNANatives ] unable to install syscall filter: Java.lang.UnsupportedOperationException: secco...
解析-1712 项目管理 PMP 冲刺模拟二 1. A company wants to ensure that project failures are addressed in project documentation. Where should the projec...
虎,楷书有很多写法。楷书的个子中等偏上。像是一只猛虎,在寒风中,站在崖头岩石,回头眺望山下。 我曾试着写出不同的姿态,比如说写矮一些,写胖一些,或者写瘦一些,都不如在中庸的基础上,取高大阳刚之气,更贴近此字的本意。 中国的汉字,是形声意的完美结合,在世界诸多文字中独一无二。...
今天沙游课结束后,10岁萌娃跟我聊起了王者荣耀,看了我的号后说“老师你的英雄好low!”,一起探讨哪个英雄厉害,探讨玩游戏时间,探讨游戏和学习,探讨孩子喜欢的事情,探讨探讨着,我们又回到沙游的画面,听孩子讲沙游作品的故事!
这是第五次课,唯一一次没有了代表他的...
她微笑着站在机场,背着书包,拖着行李箱。望着周围不熟悉的一切。她现在要投入到新的生活中,也不知道未来是好是坏,只知道这是她从小到大的梦想,她的家境很好,明明可以靠关系就能得到很多,但她从很小的时候就对自己说不管做什么都要靠自己,所以这一次,她离开家里,离开家里人的庇...
杨庙乡大王庄小学国学文化进校园
恍惚地回到宿舍,宿舍里空无一人。茫然间瞥到我书桌上的口红,我像疯了一样把它捧在手上问它:为什么和陆修远在一起的不是我?为什么?
又是一个周三,天气阴沉沉的不见一点阳光,去上课前我特地涂上了那只口红。
“宋词,你...1702人阅读
ElasticSearch(54)
转载(428)
本文未使用这个方法,而是新建了一个es账户,把es文件夹的权限赋值给这个账户,然后用它启动es。
如果以root身份运行将会出现以下问题
root@yxjay:/opt/elasticsearch-2.3.5/bin# ./elasticsearch
Exception in thread "main" .lang.RuntimeException: don't run elasticsearch
as root.at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93)at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
解决方法1:
在执行elasticSearch时加上参数-Des.insecure.allow.root=true,完整命令如下
解决办法2:
用vi打开elasicsearch执行文件,在变量ES_JAVA_OPTS使用前添加以下命令
如下图所示,这个方法的好处是以后不用添加参数就能以root身份执行了
参考出处:http://stackoverflow.com/questions//how-to-run-elasticsearch-2-1-1-as-root-user-in-linux-machine
转自:http://blog.csdn.net/u/article/details/
参考:http://blog.csdn.net/gsying1474/article/details/}

我要回帖

更多关于 elasticsearch root 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信