赞
踩
cd /data/elasticsearch
ES集群安装要求桥接网络和一定的vm配置,执行./network.sh
sysctl -w vm.max_map_count=262144
docker network ls
docker network create --driver bridge --subnet=172.18.12.0/16 --gateway=172.18.0.1 esnet
下载链接见:https://download.csdn.net/download/qq_33034733/88137295
tar -zxvf es-cfg.tar.gz cfg
给master.sh加执行权限:chmod u+x master.sh
执行./master.sh 直接创建2个主节点,
for port in $(seq 1 2); \ do \ mkdir -p /data/elasticsearch/master-${port}/config cp -rf /data/elasticsearch/cfg/* /data/elasticsearch/master-${port}/config mkdir -p /data/elasticsearch/master-${port}/data mkdir -p /data/elasticsearch/master-${port}/logs mkdir -p /data/elasticsearch/master-${port}/plugins chmod -R 777 /data/elasticsearch/master-${port} cat << EOF > /data/elasticsearch/master-${port}/config/elasticsearch.yml cluster.name: imes-es #集群的名称,同一个集群该值必须设置成相同的 node.name: es-master-${port} #该节点的名字 node.master: true #该节点有机会成为master节点 node.data: false #该节点可以存储数据 network.host: 0.0.0.0 http.host: 0.0.0.0 #所有http均可访问 http.port: 920${port} transport.tcp.port: 930${port} http.cors.enabled: true http.cors.allow-origin: "*" xpack.security.enabled: true xpack.security.transport.ssl.enabled: true xpack.security.transport.ssl.verification_mode: certificate xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12 xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12 discovery.zen.ping_timeout: 10s #设置集群中自动发现其他节点时ping连接的超时时间 discovery.seed_hosts: ["172.18.12.91:9301","172.18.12.92:9302"] cluster.initial_master_nodes: ["es-master-1"] #新集群初始时的候选主节点,es7的新增配置 EOF docker run --name es-master-${port} \ -p 920${port}:920${port} -p 930${port}:930${port} \ --privileged=true --network=esnet --ip 172.18.12.9${port} \ -e ES_JAVA_OPTS="-Xms512m -Xmx512m" \ -v /data/elasticsearch/master-${port}/config:/usr/share/elasticsearch/config \ -v /data/elasticsearch/master-${port}/data:/usr/share/elasticsearch/data \ -v /data/elasticsearch/master-${port}/logs:/usr/share/elasticsearch/logs \ -v /data/elasticsearch/master-${port}/plugins:/usr/share/elasticsearch/plugins \ -d elasticsearch:7.10.1 done
给slave.sh加执行权限:chmod u+x slave.sh
然后执行./slave.sh 直接创建3个从节点的实例
for port in $(seq 4 6); \ do \ mkdir -p /data/elasticsearch/node-${port}/config cp -rf /data/elasticsearch/cfg/* /data/elasticsearch/node-${port}/config mkdir -p /data/elasticsearch/node-${port}/data mkdir -p /data/elasticsearch/node-${port}/logs mkdir -p /data/elasticsearch/node-${port}/plugins chmod -R 777 /data/elasticsearch/node-${port} cat << EOF > /data/elasticsearch/node-${port}/config/elasticsearch.yml cluster.name: imes-es #集群的名称,同一个集群该值必须设置成相同的 node.name: es-node-${port} #该节点的名字 node.master: false #该节点有机会成为master节点 node.data: true #该节点可以存储数据 network.host: 0.0.0.0 http.host: 0.0.0.0 #所有http均可访问 ![img](https://img-blog.csdnimg.cn/img_convert/28017fb716be3f69339ba24bc0bd4bcc.png) ![img](https://img-blog.csdnimg.cn/img_convert/1c01eeaa99078d3e778df443fef38071.png) ![img](https://img-blog.csdnimg.cn/img_convert/d50bbf825a2742c2dcae0250ae6e62ac.png) **既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!** **由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新** **[需要这份系统化资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618545628)** ,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新** **[需要这份系统化资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618545628)**
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。