elasticsearch6.x集群环境部署

时间:2022-05-27 13:25:11

elasticsearch集群部署
安装jdk

chmod 755 jdk-8u161-linux-x64.tar.gz
tar -zxvf jdk-8u161-linux-x64.tar.gz
cp jdk1.8.0_161 /data/install

创建elasticsearch执行用户

useradd elastic
mkdir /data/install/elastic
chmod -R 777 /data/install/elastic
安装elasticsearch-head插件

yum -y install nodejs
yum -y install yum-utils
yum -y install openssl
yum -y update openssl
yum-config-manager --enable cr
yum update

mkdir /data/install/nodejs
npm config set prefix "/data/install/nodejs"
npm install -g grunt
cp /data/ftp/elasticsearch-head-master.zip /data/install/elastic
unzip /data/install/elastic/elasticsearch-head-master.zip
cd /data/install/elastic/elasticsearch-head-master
npm install

启动服务
grunt server &

安装elasticsearch

cp /data/ftp/elasticsearch-6.2.4.tar.gz /data/install/elastic
su elastic
cd /data/install/elastic
tar -zxvf elasticsearch-6.2.4.tar.gz

1.配置master node
    cluster.name: qsearch
    node.name: qsearch-master
    node.data: false
    node.master: true
    path.data: /data/install/elastic/data
    path.logs: /data/install/elastic/logs
    network.host: 本机内网ip
    # 本机ip或其他集群中机器的ip,随便写几个就行,不用全写,只要有一台机连上,就# 能自动加入集群
    discovery.zen.ping.unicast.hosts: ['host1', 'host2', ...]
    # 防止脑裂
    discovery.zen.minimum_master_nodes: number of master-nodes / 2 + 1

2.配置client node
    cluster.name: qsearch
    node.name: qsearch-client
    node.data: false
    node.master: false
    path.data: /data/install/elastic/data
    path.logs: /data/install/elastic/logs
    network.host: 本机内网ip
    discovery.zen.ping.unicast.hosts: ['host1', 'host2', ...]

3.配置data node
    cluster.name: qsearch
    node.name: qsearch-data
    node.data: false
    node.master: false
    path.data: /data/install/elastic/data
    path.logs: /data/install/elastic/logs
    network.host: 本机内网ip
    discovery.zen.ping.unicast.hosts: ['host1', 'host2', ...]
    bootstrap.mlockall: true

系统配置

以下是data node必配,其他的参考:https://blog.csdn.net/iorichang/article/details/53840824

vim /etc/security/limits.conf
    elastic soft nofile 65536
    elastic hard nofile 65536
    elastic soft memlock unlimited
    elastic hard memlock unlimited

vim /etc/sysctl.conf
    vm.swappiness=1 # 关闭 swapping
    net.core.somaxconn=65535 # 上调端口的最大连接数
    vm.max_map_count=262144
    fs.file-max=518144

安装分词+拼音插件

源码编译安装:
1.安装maven
2.解压
elasticsearch-analysis-ik-6.2.4.source.zip
elasticsearch-analysis-pinyin-master.source.zip
3.进入解压目录,输入mvn clean package 编译
4.编译结果在:/target/releases/XXXX.zip
5.安装插件:elasticsearch-plugin install /target/releases/xxxx.zip

也可以已经编译好的插件zip包,直接安装就可以
---------------------
作者:yonggeit
来源:CSDN
原文:https://blog.csdn.net/yonggeit/article/details/86528870
版权声明:本文为博主原创文章,转载请附上博文链接!