编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

ES单机通过端口搭建伪集群(如何搭建es集群)

wxchong 2024-11-07 13:08:57 开源技术 33 ℃ 0 评论

1、安装jdk11

#查看可安装jdk版本
yum  list|grep jdk
#安装jdk11
yum install java-11-openjdk.x86_64
或者下载压缩包解压安装
#检查jdk环境变量
 vim /etc/profile
#如果路径不对,修改路径后,执行
source /etc/profile

2、wget 获取elasticsearch压缩包

https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7.12.1.zip

https://pan.baidu.com/s/1u-3M4yr7zTjioYQZQKCeYQ 提取码:vfr3

3、建三个目录master,node1,node2

cp elasticsearch-7.12.1-darwin-x86_64.tar.gz master等三个目录

4、root用户需授权

chown -R elastic:elastic elasticsearch-7.12.1

elasticsearch需要普通用户启动,不能root启动

5、elasticsearch.yml配置

cluster.name: myCluster
node.name: master
node.attr.rack: r1
path.data: /opt/elasticsearch/master/data
path.logs: /opt/elasticsearch/master/log
bootstrap.memory_lock: true
http.port: 9200
transport.tcp.port: 9300
#这里如果curl 127.0.0.1:9200拒绝访问就不能配置127.0.0.1,否则查看节点时只能看到一个节点
discovery.seed_hosts: ["192.168.0.177:9300", "192.168.0.177:9301", "192.168.0.177:9302"]
cluster.initial_master_nodes: ["master", "node1", "node2"]
node.master: true
node.data: true
http.cors.enabled: true
http.cors.allow-origin: "*"
xpack.ml.enabled: false

6、获取ik分词器

wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.12.1/elasticsearch-analysis-ik-7.12.1.zip

7、创建ik目录

mkdir ik
unzip elasticsearch-analysis-ik-7.12.1.zip
cp -r ik master/elasticsearch-7.12.1/plugins

7、启动nohup ./bin/elasticsearch -d

http://192.168.0.177:9200/_cat/nodes?v


Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表