1、装依赖
yum install -y java-1.8.0-openjdk
2、安装elasticsearch
-
目录创建 mkdir -p /opt/{soft,conf,logs,scripts};mkdir -p /data0/elasticsearch
-
文件解压缩 tar xzvf elasticsearch-5.6.3.tar.gz -C /opt/soft/
-
建立软连接 ln -s /opt/soft/elasticsearch-5.6.3 /opt/soft/elasticsearch
-
添加elastic 用户 adduser elastic -d /opt/soft/elasticsearch -s /sbin/nologin
-
权限赋予 chown -R elastic.elastic /opt/soft/elasticsearch; chown -R elastic.elastic /data0/elasticsearch
3、配置文件修改
3.1 系统配置文件:
3.1.1 #vi /etc/security/limits.conf
追加如下内容
elastic soft memlock unlimited
elastic hard memlock unlimited
End of file
* soft nproc unlimited
* hard nproc unlimited
* soft nofile 655350
* hard nofile 655350
3.1.2 # vi /etc/sysctl.conf
追加如下内容:
vm.max_map_count=262144
3.1.3 #编辑init 文件
vi /etc/init.d/elasticsearch
根据自身情况,修改如下内容
具体内容
3.1.4 #编辑hosts文件添加如下内容
csharp;gutter:true;
echo "::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1 es01 es01
192.168.0.2 es2.hq
192.168.0.3 es3.hq
192.168.0.4 es4.hq" > /etc/hosts
3.2 elasticsearch 相关配置文件修改
3.2.1 #vi /opt/conf/elasticsearch/config/elasticsearch.yml
cluster.name: HQES
node.name: es8.hq
node.master: true
node.data: true
path.data: /data0/elasticsearch
path.logs: /opt/log/elasticsearch/
bootstrap.memory_lock: true
network.publish_host: es8.hq #根据/etc/hosts内容在不同主机中修改
network.bind_host: 0.0.0.0
discovery.zen.minimum_master_nodes: 3
discovery.zen.ping.unicast.hosts: [“es8.hq”, “es9.hq”, “es10.hq”, “es11.hq”,”es12.hq”] #/etc/hosts内容修改
discovery.zen.fd.ping_timeout: 120s
discovery.zen.fd.ping_retries: 6
discovery.zen.fd.ping_interval: 30s
client.transport.ping_timeout: 60s
discovery.zen.ping_timeout: 120s
xpack.security.enabled: false
http.cors.allow-origin: “/.*/”
http.cors.allow-origin: “*”
http.cors.enabled: true
gateway.recover_after_nodes: 2
gateway.recover_after_time: 5m
gateway.expected_nodes: 2
cluster.routing.allocation.node_initial_primaries_recoveries: 6
cluster.routing.allocation.node_concurrent_recoveries: 3
indices.recovery.max_bytes_per_sec: 50mb
3.2.2 #vi /opt/soft/elasticsearch/bin/elasticsearch
查找ES_JAVA_OPTS修改如下:
ES_JAVA_OPTS=”-Xms8g -Xmx8g -Dlog4j2.disable.jmx=true”
3.2.3 #vi /opt/conf/elasticsearch/config/log4j2.properties
3.2.4: mkdir -p /opt/log/elasticsearch
chchown -R elastic.elastic /opt/log/elasticsearch
4、#启动:
service elasticsearch start
Original: https://www.cnblogs.com/mafeng/p/15069970.html
Author: ma_fighting
Title: centos 7 无痛安装 es
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/545706/
转载文章受原作者版权保护。转载请注明原作者出处!