es 7.8.0 linux 集群

1.  下载es linux版本的数据包

地址: https://www.elastic.co/cn/downloads/past-releases#elasticsearch

 

解压: 

解压 tar -xzvf xxx

2. 我是在一个服务器上测试的,实际上是不同的服务器

所以复制了三份,模拟多节点

 进去之后主要是修改elasticsearch.yml 内容如下

节点一:

找到config的目录
cd /usr/local/es-cluster/es-7.8.0-node0/config/
里面有个 elasticsearch.yml 文件

修改内容为:
# ======================== Elasticsearch Configuration =========================

cluster.name: my-cluster

node.name: node-0

#是不是有资格主节点 
node.master: true 
node.data: true
#被访问的地址
network.host: 192.168.1.1

http.port: 9200
#节点之间的通讯
transport.tcp.port: 9300
#其他节点地址
discovery.seed_hosts: ["192.168.1.1:9300","192.168.1.1:9301","192.168.1.1:9302"]

cluster.initial_master_nodes: ["node-0"]

gateway.recover_after_nodes: 2

#跨域
http.cors.enabled: true
http.cors.allow-origin: "*"

节点二:

找到config的目录
cd /usr/local/es-cluster/es-7.8.0-node1/config/
里面有个 elasticsearch.yml 文件

修改内容为:
# ======================== Elasticsearch Configuration =========================

cluster.name: my-cluster

node.name: node-1

#是不是有资格主节点 
node.master: true 
node.data: true
#被访问的地址
network.host: 192.168.1.1

http.port: 9201
#节点之间的通讯
transport.tcp.port: 9301
#其他节点地址
discovery.seed_hosts: ["192.168.1.1:9300","192.168.1.1:9301","192.168.1.1:9302"]

cluster.initial_master_nodes: ["node-0"]

gateway.recover_after_nodes: 2

#跨域
http.cors.enabled: true
http.cors.allow-origin: "*"

节点三:

找到config的目录
cd /usr/local/es-cluster/es-7.8.0-node1/config/
里面有个 elasticsearch.yml 文件

修改内容为:
# ======================== Elasticsearch Configuration =========================

cluster.name: my-cluster

node.name: node-2

#是不是有资格主节点 
node.master: true 
node.data: true
#被访问的地址
network.host: 192.168.1.1

http.port: 9202
#节点之间的通讯
transport.tcp.port: 9302
#其他节点地址
discovery.seed_hosts: ["192.168.1.1:9300","192.168.1.1:9301","192.168.1.1:9302"]

cluster.initial_master_nodes: ["node-0"]

gateway.recover_after_nodes: 2

#跨域
http.cors.enabled: true
http.cors.allow-origin: "*"

注意的是:如果你的 data 和logs 下面有数据的话, 必须先清空之后再启动

es 在linux 上启动的时候不能使用root用户启动, 如果你当前是root可以先创建一个用户并且切换过去之后,再进行以上操作,避免授权的麻烦

如果先进行的以上操作,可以执行以下

useradd es 新增用户

passwd es 为用户设置密码

userdel -r es  删除用户

授权

chown -R es:es /usr/local/es-cluster/

接下来一个个启动就行了

./bin/elasticsearch  
./bin/elasticsearch -d 后台启动

备注:

关于ik中文分词器,可以去GitHub 下载相关版本的zip, 然后再 es节点的插件下面创建一个文件夹ik

/usr/local/es-cluster/es-7.8.0-node0/plugins/ik/

然后将zip上传到ik文件夹下面,解压就可以了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值