elasticsearch安装和配置
elasticsearch启动报错:can not run elasticsearch as root
elasticsearch启动报错:ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [3818] for user [es] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
================================
©Copyright 蕃薯耀 2021-02-20
http://fanshuyao.iteye.com/
一、elasticsearch解压安装
1、解压elasticsearch
cd /java/es6/
tar -zxvf elasticsearch-6.8.13.tar.gz
2、修改文件夹名称和移动位置
mv elasticsearch-6.8.13 /java/elasticsearch6
3、进入配置文件目录
cd /java/elasticsearch6/config
[root@host-12 java]# cd /java/elasticsearch6/config
[root@host-12 config]# ll
总用量 32
-rw-r-----. 1 631 503 2853 10月 16 17:04 elasticsearch.yml
-rw-r-----. 1 631 503 3885 10月 16 17:04 jvm.options
-rw-r-----. 1 631 503 13085 10月 16 17:17 log4j2.properties
-rw-r-----. 1 631 503 473 10月 16 17:17 role_mapping.yml
-rw-r-----. 1 631 503 197 10月 16 17:17 roles.yml
-rw-r-----. 1 631 503 0 10月 16 17:17 users
-rw-r-----. 1 631 503 0 10月 16 17:17 users_roles
4、创建数据和日志目录
mkdir -p /java/elasticsearch6/esdata mkdir -p /java/elasticsearch6/eslogs
5、修改配置文件:
vi /java/elasticsearch6/config/elasticsearch.yml
修改内容:
#集群名称 cluster.name: myes6 #节点名称 node.name: node-11 #数据目录 path.data: /java/elasticsearch6/esdata #日志目录 path.logs: /java/elasticsearch6/eslogs # 是否锁定内存在启动时 bootstrap.memory_lock: false #centos6.x操作系统不支持SecComp,默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。 #如果不配置,会出现错误:system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk bootstrap.system_call_filter: false #IP地址 network.host: 192.168.170.11 #端口号 http.port: 9200 #集群发现 discovery.zen.ping.unicast.hosts: ["192.168.170.11", "192.168.170.12", "192.168.170.13"]
二、elasticsearch设置环境变量
1、配置elasticsearch运行的环境变量,简化命令,配置后,不用拼写完整路径:
vi /etc/profile
2、在文件的最后加上:
ELASTICSEARCH_HOME=/java/elasticsearch6/ PATH=$PATH:$ELASTICSEARCH_HOME/bin export ELASTICSEARCH_HOME PATH
3、让环境变量配置立即生效:
source /etc/profile
三、启动elasticsearch
/java/elasticsearch6/bin/elasticsearch
如果设置环境变量,则可以:
elasticsearch
elasticsearch启动时报错:can not run elasticsearch as root
不能使用root启动
Caused by: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) ~[elasticsearch-6.8.13.jar:6.8.13] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-6.8.13.jar:6.8.13] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.13.jar:6.8.13] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.13.jar:6.8.13] ... 6 more
增加es用户:
groupadd es useradd es -g es passwd es
新的 密码:
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
#设置文件夹的权限
cd /java chown -R es:es elasticsearch6
切换为es用户:
su es
再次启动:
/java/elasticsearch6/bin/elasticsearch
ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [3818] for user [es] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2021-02-04T16:28:09,472][INFO ][o.e.n.Node ] [node-11] stopping ...
[2021-02-04T16:28:09,546][INFO ][o.e.n.Node ] [node-11] stopped
[2021-02-04T16:28:09,546][INFO ][o.e.n.Node ] [node-11] closing ...
[2021-02-04T16:28:09,576][INFO ][o.e.n.Node ] [node-11] closed
切换到Root用户:
su root
[1][2]解决(切换到root用户):
vi /etc/security/limits.conf
文件后面添加下面的内容:
# soft表示为超过这个值就会有warnning # hard则表示不能超过这个值 * soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096
如果[1]方法没有解决[2],可以再执行下面的解决[2](切换到root用户):
【20-nproc.conf】这个文件可能每个人都不一样,可以进入目录查看具体的文件
vi /etc/security/limits.d/20-nproc.conf
Centos7默认就是:4096,不需要再修改,如果不是,请修改
* soft nproc 4096 root soft nproc unlimited
[3]解决(切换到root用户):
vi /etc/sysctl.conf
增加内容:
vm.max_map_count=655360
保存后,执行命令:
sysctl -p
最后重启Linux系统(必须),不重启不生效
切换为es用户:
su es
再次启动:
/java/elasticsearch6/bin/elasticsearch
或后台启动:
/java/elasticsearch6/bin/elasticsearch -d
后台启动可以通过jsp查看有没有进程。
[root@host-11 ~]# jps
992 QuorumPeerMain
1490 Elasticsearch
1551 Jps
启动成功后,进行验证:
[node-11] publish_address {192.168.170.11:9200}, bound_addresses {192.168.170.11:9200}
[node-11] license [bf28e518-3560-4e69-a605-4e97b2055ba7] mode [basic] - valid
进行验证:
浏览器打开:
http://192.168.170.11:9200/
或者在Linux命令窗口验证:
curl http://192.168.170.11:9200/
返回结果:
{
"name" : "node-11",
"cluster_name" : "myes6",
"cluster_uuid" : "xDGeM7glQECODLuS32Qo9A",
"version" : {
"number" : "6.8.13",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "be13c69",
"build_date" : "2020-10-16T09:09:46.555371Z",
"build_snapshot" : false,
"lucene_version" : "7.7.3",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
查看集群状态:
http://192.168.170.11:9200/_cluster/stats?pretty
查看单个节点状态:
http://192.168.170.11:9200/_nodes/node-11/process?pretty
查看ES集群健康状态
http://192.168.170.11:9200/_cluster/health?pretty
{
"cluster_name" : "myes6", //集群名称
"status" : "green", //集群的状态红绿灯,绿:健康,黄:亚健康,红:病态
"timed_out" : false,
"number_of_nodes" : 2, //节点数
"number_of_data_nodes" : 2, //数据节点数
"active_primary_shards" : 12,
"active_shards" : 24,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}
查看指定索引库的健康状态
http://192.168.170.11:9200/_cluster/health/stu?pretty
多个索引:
http://192.168.170.11:9200/_cluster/health/index_name1,index_name2?pretty
查看集群的主节点:
浏览器打开:
http://192.168.170.12:9200/_cat/master?v
或者在Linux命令窗口验证:
curl 192.168.170.12:9200/_cat/master?v
输出内容:
id host ip node
CDH9HpfRRmaAN3VBbj4Vow 192.168.170.11 192.168.170.11 node-11
(如果文章对您有所帮助,欢迎捐赠,^_^)
================================
©Copyright 蕃薯耀 2021-02-20
http://fanshuyao.iteye.com/
相关推荐
报错信息提示"can not run elasticsearch as root",意味着在尝试用root用户启动Elasticsearch服务,但这是不被允许的。 自Elasticsearch 6.x版本开始,出于安全性考虑,官方明确禁止以root用户身份运行Elastic...
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root. ``` - **原因解析**:这是出于安全考虑的设定。因为Elasticsearch可以执行用户提交的脚本,所以推荐使用一个专用的非...
- **cannot run elasticsearch as root**:Elasticsearch禁止以root用户身份运行。 - 解决方案:创建一个非root用户并赋予权限。例如,使用`useradd username`创建新用户,然后通过`chown -R username /home/...
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....
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root ``` 解决方案: 1. 新建用户和用户组。 2. 修改 Elasticsearch 安装目录的所有权。 3. 切换...
$ docker run --name elasticsearch-exporter bitnami/elasticsearch-exporter:latest 为什么要使用Bitnami Images? Bitnami密切跟踪上游源代码变化,并使用我们的自动化系统及时发布该图像的新版本。 对于...
最后,我们可以使用 scripts 目录下的 run_es_6.7.1.sh 脚本启动 Elasticsearch: ``` [root@localhost es-6.7.1]# cat scripts/run_es_6.7.1.sh #!/bin/bash docker run -d --name es-6.7.1 -p 9200:9200 -p 9300:...
$ docker run --name elasticsearch bitnami/elasticsearch:latest Docker撰写 $ curl -sSL ...
Elasticsearch(简称ES)是一种基于Lucene的分布式、RESTful风格的搜索和数据分析引擎,广泛应用于全文检索、日志分析、实时监控等多种场景。在Java开发中,Elasticsearch作为一个强大的搜索引擎,常被用于构建高...
Elasticsearch Curator可帮助管理和管理Elasticsearch索引。 TL; DR $ docker run --name elasticsearch-curator bitnami/elasticsearch-curator:latest Docker撰写 $ curl -sSL ...
docker安装并启动elasticsearch时内存不足 系统centos8(阿里云ecs服务器) [root@iZ2zeczvvb79boy368xppwZ ~]# cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core) 安装过程 docker pull elastic...
总结来说,安装Elasticsearch在CentOS 7上涉及下载软件包、解压、配置JVM内存、创建非root用户、调整系统参数以及安装可视化工具。每一步都至关重要,且需要注意错误提示,以便及时解决问题。遵循这些步骤,你应该...
**场景描述**:本文档旨在指导如何将MySQL数据库中的数据以全量和增量的方式同步到ElasticSearch搜索引擎中。 **1. 下载内容** - **elasticsearch版本 6.3.2**:Elasticsearch是一个基于Lucene的搜索服务器,提供了...
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 --name es01 docker.elastic.co/elasticsearch/elasticsearch:6.3.2 ``` 部署完成后,可以通过浏览器打开http://localhost:9200,...
7d96469f2eda elasticsearch:7.13.2 "/bin/tini -- /usr/l…" About an hour ago Up About an hour 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 9300/tcp elasticsearch 可以使用 netstat 命令来查看 es 和 kibana...
全志R16平台的Android6系统下调通rtl8189es 2017/8/28 9:41 ...# # we will start as root and wpa_supplicant will switch to user wifi # # after setting up the capabilities required for WEXT # # ...
全志R16平台的Android6系统下调通rtl8189es 2017/8/28 9:41 ...# # we will start as root and wpa_supplicant will switch to user wifi # # after setting up the capabilities required for WEXT # # ...
##### 1、主机1上安装和配置keepalived 在主机1上安装并配置Keepalived以监控mysqld进程。配置文件示例如下: ```bash # cat /etc/keepalived/keepalived.conf vrrp_script chk_mysqld { script "/usr/local/bin/...