This article is to deploy a standalone Elasticsearch service. is installed through Yum.
Elasticsearch requires a Java environment. Another article has a description of the configuration JAVA8 environment.
1: First download GPG signature file: RPM--import Https://packages.elastic.co/GPG-KEY-elasticsearch
2: Add elasticsearch Yum Source: Vim/etc/yum.repo.d/elasticsearck.repo Add the following:
Name=elasticsearch repository for 2.x packages
Baseurl=http://packages.elastic.co/elasticsearch/2.x/centos
Gpgcheck=1
Gpgkey=http://packages.elastic.co/gpg-key-elasticsearch
Enabled=1
3:yum clean all; Yum repolist flush Yum Cache
4: Install Elasticsearch; Yum-y Install Elasticsearch
5: Change config file: vim/etc/elasticsearch/elasticsearch.yml
1. Several basic nouns
The index in Index:es is equivalent to a database.
Type: equivalent to a table in the database.
ID: Unique, equivalent to the primary key.
Node: Nodes are ES instances, one machine can run multiple instances, but instances on the same machine make sure the HTTP and TCP ports are different in the configuration file (say below).
Cluster: Represents a cluster, there are multiple nodes in the cluster, one of which will be selected as the primary node, which can be elected, the master node is for the internal cluster.
Shards: Represents the index Shard, es can divide a complete index into multiple shards, the advantage is that a large index can be split into multiple, distributed to different nodes, to form a distributed search. The number of shards can only be specified before the index is created, and cannot be changed after the index is created.
Replicas: Represents a copy of the index, ES can set a copy of multiple indexes, the role of a copy is to improve the system's fault tolerance, when a node a shard corruption or loss can be recovered from the replica. The second is to improve the query efficiency of ES, ES will automatically load balance the search request.
Cluster.name:elasticsearch
#这是集群名字, we are named Elasticsearch.
#es启动后会将具有相同集群名字的节点放到一个集群下.
Node.name: "Es-node1"
#节点名字.
Discovery.zen.minimum_master_nodes:2
#指定集群中的节点中有几个有master资格的节点.
#对于大集群可以写3个以上.
discovery.zen.ping.timeout:40s
#默认是3s, this is the time to set the ping connection timeout when other nodes are automatically discovered in the cluster.
#为避免因为网络差而导致启动报错, I set it to 40s.
Discovery.zen.ping.multicast.enabled:false
#设置是否打开多播发现节点, the default is true.
network.bind_host:192.168.137.100
#设置绑定的ip地址, this is the IP of my master virtual machine.
network.publish_host:192.168.137.100
#设置其它节点和该节点交互的ip地址.
network.host:192.168.137.100
#同时设置bind_host和publish_host上面两个参数.
Discovery.zen.ping.unicast.hosts: ["192.168.137.100", "192.168.137.101", "192.168.137.100:9301"]
#discovery. zen.ping.unicast.hosts:["Node 1 IP", "Node 2 IP", "Node 3 IP"]
#指明集群中其它可能为master的节点ip,
#以防es启动后发现不了集群中的其他节点.
#第一对引号里是node1, the default port is 9300,
#第二个是 Node2, on the other machine,
#第三个引号里是node3, because it is on a machine with Node1, 9301 ports are specified.
Start Service:/etc/init.d/elasticsearch start
Test: Curl ' http://ip:9200 '
..... Not to be continued
Deployment of monolithic Elasticsearch services under Linux