ES集群(Elasticsearch)在CentOS的搭建

2019-06-11  本文已影响0人  Okami_

下载安装包

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.0.tar.gz

新增系统用户

# 新建用户
adduser es  
# 给新用户添加密码
passwd es
# 切换登陆用户
su es
mv elasticsearch-6.8.0.tar.gz /home/es/elasticsearch

解压安装包

cd /home/es/elasticsearch
tar -xzvf elasticsearch-6.8.0.tar.gz

修改配置文件

vi config/elasticsearch.yml 
#集群的名称,同一个集群该值必须设置成相同的
cluster.name: okami-application
#该节点的名字
node.name: node-1
#该节点有机会成为master节点
node.master: true
#该节点可以存储数据
node.data: true
#shard的数目
#index.number_of_shards: 5
#数据副本的数目
#index.number_of_replicas: 3
#设置绑定的IP地址,可以是IPV4或者IPV6
network.bind_host: 0.0.0.0
#设置其他节点与该节点交互的IP地址
network.publish_host: 192.168.10.1
#该参数用于同时设置bind_host和publish_host
network.host: 192.168.10.1
#设置节点之间交互的端口号
transport.tcp.port: 9300
#设置是否压缩tcp上交互传输的数据
transport.tcp.compress: true
#设置对外服务的http端口号
http.port: 9200
#设置http内容的最大大小
http.max_content_length: 100mb
#是否开启http服务对外提供服务
http.enabled: true 
#设置这个参数来保证集群中的节点可以知道其它N个有master资格的节点。默认为1,对于大的集群来说,可以设置大一点的值(2-4)
discovery.zen.minimum_master_nodes: 1
#设置集群中自动发现其他节点时ping连接的超时时间
discovery.zen.ping_timeout: 120s
#设置是否打开多播发现节点
#discovery.zen.ping.multicast.enabled: true
#设置集群中的Master节点的初始列表,可以通过这些节点来自动发现其他新加入集群的节点
discovery.zen.ping.unicast.hosts: ["192.168.10.1:9300"]

path.data: /usr/hdp/2.5.0.0-1245/esdata
path.logs: /usr/hdp/2.5.0.0-1245/eslog

http.cors.enabled: true
http.cors.allow-origin: "*"
#--------------------------------------------------------------------------------
#index.analysis.analyzer.ik.type: "ik"

启动ES

[es@okami elasticsearch-7.1.1]# java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
./home/es/elasticsearch/elasticsearch-6.8.0/bin/elasticsearch -d
[es@okami ~]#  curl http://127.0.0.1:9200
{
  "name" : "node-1",
  "cluster_name" : "okami-application",
  "cluster_uuid" : "Q00-w01oQT6vsXx7E6KIeA",
  "version" : {
    "number" : "6.8.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "65b6179",
    "build_date" : "2019-05-15T20:06:13.172855Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

安装部署其他主机

检查集群的部署情况

[es@okami ~]#  curl http://127.0.0.1:9200/_cluster/health
{"cluster_name":"okami-application","status":"green","timed_out":false,"number_of_nodes":3,"number_of_data_nodes":3,"active_primary_shards":0,"active_shards":0,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":100.0}



安装中遇到的问题

上一篇 下一篇

猜你喜欢

热点阅读