ES集群的安装

ES集群的安装

1 安装java环境
   yum -y install java-1.8.0-openjdk*->需要最新的JDK环境1.8

2. 2 安装 es
   curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.2.0.tar.gz

tar -xvf elasticsearch-7.2.0.tar.gz

es不能使用root用户  需要创建账号。es用户: es  密码:1qaz2wsx

useradd es

3 配置集群
  相关配置文件
  elasticsearch.yml
  cluster.name: es-cluster 配置集群名称 三台服务器保持一致
  node.name: node-1 配置单一节点名称,每个节点唯一标识
  network.host: x.x.x.x 设置绑定的ip地址
  http.port: 9200 端口

cluster.initial_master_nodes: ["10.253.96.81:9300","10.253.96.123:9300","10.253.96.124:9300"]

#内部通信端口

transport.tcp.port: 9300

#外网访问权限

http.cors.enabled: true

http.cors.allow-origin: "*"

http.cors.allow-credentials: true

http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE

http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, X-User"

以此类推,完成另外两个节点的配置。cluster.name的名称必须保持一样。然后分别设置node.name

4 linux系统优化
  vm.max_map_count=655360 添加/etc/sysctl
  * soft nofile 65536
  * hard nofile 65536 添加/etc/security/limits.conf
  vm.zone_reclaim_mode = 0 添加/etc/sysctl,可以先查看,一部分服务器默认是为0 另一部分不是,可能会引起cpu暴涨的

5 启动es

切换到es的用户,然后逐个启动:elasticsearch –d

6.启动异常排除

1. max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

解决方案:

切换到root用户下,编辑/etc/security/limits.conf文件

vim /etc/security/limits.conf

编辑内容如下:

* soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096

2 max number of threads [1024] for user [hadoop] is too low, increase to at least [2048]

解决方案:

在root用户下

vim /etc/security/limits.d/90-nproc.conf

修改如下内容:

# 将

# * soft nproc 1024

# 修改为

* soft nproc 2048

3 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解决方案:

在root用户下

编辑vim /etc/sysctl.conf文件

添加下面配置:

vm.max_map_count=655360

并执行命令:

sysctl -p

4 system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

这是在因为Centos6不支持SecComp,而ES5.2.0默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。

解决方案:

在elasticsearch.yml中配置bootstrap.system_call_filter为false

bootstrap.system_call_filter: false

1

3.5 Java HotSpot™ 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error=‘Cannot allocate memory’ (errno=12)

这个问题表示jvm的内存不足

解决方案:

vim config/jvm.options

# 将jvm内存参数2g改为512m

# -Xms2g 

# -Xmx2g 

# 修改为 

-Xms512m 

-Xmx512m

猜你喜欢

转载自blog.csdn.net/weixin_39352976/article/details/108593166