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<

*       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

 

查看集群节点详细信息:

elasticsearch集群布署_第1张图片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

你可能感兴趣的:(Linux日常运维)