栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

centos7 elasticsearch 安装启动问题

centos7 elasticsearch 安装启动问题

一、下载安装
1、创建目录 
mkdir /usr/local/elasticsearch

2、赋权限 

chmod 751 /usr/local/elasticsearch

3、下载安装
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.2-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.2-linux-x86_64.tar.gz.sha512
shasum -a 512 -c elasticsearch-7.10.2-linux-x86_64.tar.gz.sha512 
tar -xzf elasticsearch-7.10.2-linux-x86_64.tar.gz
#启动
cd elasticsearch-7.10.2/
cd bin
./elasticsearch

二、常见问题
1、wget: 未找到命令
yum -y install wget

2、shasum: 未找到命令
yum install perl-Digest-SHA

3、root用户不能启动elasticsearch
#创建elas组
groupadd elas
#创建elas用户,并且加入elas组
useradd -g elas elas
#为elas用户设定登录密码
passwd elas

4、这样启动会出现一个有迷惑性的问题:could not find java in bundled jdk at /usr/local/elasticsearch/elasticsearch-7.10.2/jdk/bin/java


实际上是新创建的elas 用户没有赋权限。
对该elasticsearch目录进行授权 命令。

sudo chown -R elas:elas /usr/local/elasticsearch/elasticsearch-7.10.2

5、启动后虚拟机外不能访问 es的9200


在elasticsearch/elasticsearch.yml 中增加 network.host: 0.0.0.0 就可以访问了。


6、启动检测问题
ERROR: [4] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

每个进程最大同时打开文件数太小,可通过下面2个命令查看当前数量
ulimit -Hn
ulimit -Sn
修改/etc/security/limits.conf文件,增加配置,用户退出后重新登录生效

*               soft    nofile          65536
*               hard    nofile          65536
[2]: max number of threads [3818] for user [elas] is too low, increase to at least [4096]

查看命令查看

ulimit -Hu
ulimit -Su


问题同上,最大线程个数太低。修改配置文件/etc/security/limits.conf,增加配置

*               soft    nproc           4096
*               hard    nproc           4096
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

修改/etc/sysctl.conf文件,增加配置vm.max_map_count=262144

vi /etc/sysctl.conf
sysctl -p


执行命令sysctl -p生效

[4]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

原因:缺少默认配置,至少需要配置discovery.seed_hosts、discovery.seed_providers、cluster.initial_master_nodes中的一个参数.

discovery.seed_hosts:  集群主机列表
discovery.seed_providers: 基于配置文件配置集群主机列表
cluster.initial_master_nodes: 启动时初始化的参与选主的node,生产环境必填

处理办法:
修改配置文件,添加参数即可
vi config/elasticsearch.yml
添加配置

cluster.name: my-application
node.name: node-1
discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: ["node-1"]
三、最后访问虚拟机的9200

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/327208.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号