elasticsearch集群布署

官网下载elasticsearch:

https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.1-linux-x86_64.tar.gz

解压缩包后配置jdk环境:

cd elasticsearch-7.8.1

mv jdk /usr/local/

mkdir /data/elasticsearch/{data,logs} -p

添加java环境系统配置:

echo "export JAVA_HOME=/usr/local/jdk" >> /etc/profile

echo "export CLASSPATH=\$JAVA_HOME/lib:\$CLASSPATH" >> /etc/profile

echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile

系统内核配置:

echo "vm.max_map_count = 655300" >>/etc/sysctl.conf

sysctl -p

cat>>/etc/security/limits.conf<<EOF

*       soft    nproc                   655350

*       hard    nproc                   655350

*       soft    nofile                  655350

*       hard    nofile                  655350

EOF

ulimit -n 655350

 

使环境配置生效:

source /etc/profile

chmod 755 -R /usr/local/jdk

useradd elastic

chown elastic:elastic /usr/local/elasticsearch -R

chown elastic:elastic /data/elasticsearch –R

各节点修改elasticsearch.yml配置文件如下:

节点1:

cluster.name: my-application

node.name: node-1

path.data: /data/elasticsearch/data

path.logs: /data/elasticsearch/logs

network.host: 192.168.199.140

http.port: 9200

discovery.seed_hosts: ["192.168.199.140", "192.168.199.141","192.168.199.142"]

cluster.initial_master_nodes: ["192.168.199.140", "192.168.199.141","192.168.199.142"]

节点2:

cluster.name: my-application

node.name: node-2

path.data: /data/elasticsearch/data

path.logs: /data/elasticsearch/logs

network.host: 192.168.199.141

http.port: 9200

discovery.seed_hosts: ["192.168.199.140", "192.168.199.141","192.168.199.142"]

cluster.initial_master_nodes: ["192.168.199.140", "192.168.199.141","192.168.199.142"]

节点3:

cluster.name: my-application

node.name: node-3

path.data: /data/elasticsearch/data

path.logs: /data/elasticsearch/logs

network.host: 192.168.199.142

http.port: 9200

discovery.seed_hosts: ["192.168.199.140", "192.168.199.141","192.168.199.142"]

cluster.initial_master_nodes: ["192.168.199.140", "192.168.199.141","192.168.199.142"]

切换至elastic用户启动elasticsearch集群:

su - elastic

/usr/local/elasticsearch/bin/elasticsearch -d

查看集群健康状况:

http://192.168.199.140:9200/_cat/health?v

 

查看集群节点详细信息:

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

 

 

每个命令都支持使用?v参数,来显示详细的信息。

help

每个命令都支持使用help参数,来输出可以显示的列:

$ curl localhost:9200/_cat/master?help

 

headers

通过h参数,可以指定输出的字段:

$ curl localhost:9200/_cat/master?v
$ curl localhost:9200/_cat/master?h=ip,node

 

 

查看_cat下可用命令:

http://192.168.199.140:9200/_cat,返回如下:

=^.^=

/_cat/allocation

/_cat/shards

/_cat/shards/{index}

/_cat/master

/_cat/nodes

/_cat/tasks

/_cat/indices

/_cat/indices/{index}

/_cat/segments

/_cat/segments/{index}

/_cat/count

/_cat/count/{index}

/_cat/recovery

/_cat/recovery/{index}

/_cat/health

/_cat/pending_tasks

/_cat/aliases

/_cat/aliases/{alias}

/_cat/thread_pool

/_cat/thread_pool/{thread_pools}

/_cat/plugins

/_cat/fielddata

/_cat/fielddata/{fields}

/_cat/nodeattrs

/_cat/repositories

/_cat/snapshots/{repository}

/_cat/templates

/_cat/ml/anomaly_detectors

/_cat/ml/anomaly_detectors/{job_id}

/_cat/ml/trained_models

/_cat/ml/trained_models/{model_id}

/_cat/ml/datafeeds

/_cat/ml/datafeeds/{datafeed_id}

/_cat/ml/data_frame/analytics

/_cat/ml/data_frame/analytics/{id}

/_cat/transforms

/_cat/transforms/{transform_id}

 

更多请参考官方文档:

https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值