🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
hdss7-12机器部署 1、下载二进制包 ``` cd /opt/src wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.6.tar.gz tar xf elasticsearch-6.8.6.tar.gz -C /opt/ ln -s /opt/elasticsearch-6.8.6/ /opt/elasticsearch cd /opt/elasticsearch ``` 2、配置elasticsearch.yml ``` mkdir -p /data/elasticsearch/{data,logs} cat >config/elasticsearch.yml <<'EOF' cluster.name: es.zq.com node.name: hdss7-12.host.com path.data: /data/elasticsearch/data path.logs: /data/elasticsearch/logs bootstrap.memory_lock: true network.host: 10.4.7.12 http.port: 9200 EOF ``` 3、优化其他设置 ``` elasticsearch]# vi config/jvm.options #根据环境设置,-Xms和-Xmx设置为相同的值,推荐设置为机器内存的一半左右 -Xms512m -Xmx512m ``` 4、创建普通用户 ``` useradd -s /bin/bash -M es chown -R es.es /opt/elasticsearch-6.8.6 chown -R es.es /data/elasticsearch/ ``` 5、整文件描述符 ``` vim /etc/security/limits.d/es.conf es hard nofile 65536 es soft fsize unlimited es hard memlock unlimited es soft memlock unlimited ``` 6、调整内核参数 ``` sysctl -w vm.max_map_count=262144 echo "vm.max_map_count=262144" > /etc/sysctl.conf sysctl -p ``` 7、启动es服务 ``` su -c "/opt/elasticsearch/bin/elasticsearch -d" es netstat -luntp|grep 9200 tcp6 0 0 10.4.7.12:9200 :::* LISTEN 16784/java ``` 8、调整ES日志模板 ``` curl -H "Content-Type: application/json" -XPUT http://10.4.7.12:9200/_template/k8s -d '{ "template" : "k8s*", "index_patterns": ["k8s*"], "settings": { "number_of_shards": 5, "number_of_replicas": 0 } }' ```