1. 程式人生 > >centos7中配置elasticsearch叢集和離線安裝x-pack

centos7中配置elasticsearch叢集和離線安裝x-pack

環境

作業系統:win7
虛擬機器:centos7
elasticsearch:5.2.2

步驟

前提條件

由於我是自己學習用,筆記本的記憶體有限,所以想在一臺虛擬機器中配置叢集。
我虛擬機器的情況是,已經安裝好了elasticsearchkibanax-pack.

網上的一般做法是把已經安裝好得elasticsearch目錄再複製一遍,而我呢!由於儲存了安裝包,所以又重新解壓了一份並且重新命名為elasticsearch-5.2.2-node-2

這樣我的目錄就是這樣:

這裡寫圖片描述

修改配置

接著就是修改配置:

# 叢集的名字修改
#cluster.name: my-application
cluster.name: yutao #叢集名字要一樣 # 修改節點名稱 #node.name: node-1 node.name: node-2 node.master: false # 表示該節點不會作為主節點 node.data: true # 表示該節點可以儲存資料,false表示只作為搜尋 # http port的修改 #http.port: 9200 http.port: 9201 # 主節點已經為9200,範圍9200-9300,自己隨便編個,前提別被佔用 # 配置tcp傳輸埠 # transport.tcp transport.tcp.port: 9301 # 預設裡沒有自己新增 # 配置所有叢集IP地址
#discovery.zen.ping.unicast.hosts: ["host1", "host2"] discovery.zen.ping.unicast.hosts: ["192.168.116.19:9300", "192.168.116.19:9301"] # 上面因為我就配了兩個,要是你配置三個就要寫三個IP地址

這裡我要特別強調:

discovery.zen.ping.unicast.hosts: ["192.168.116.19:9300", "192.168.116.19:9301"]

# 這個配置也需要在主節點中配置,有多少個節點就需要配置多少個。

這裡的埠是tcp通訊協議的埠,不是http.port

的埠。
這裡的埠是tcp通訊協議的埠,不是http.port的埠。
這裡的埠是tcp通訊協議的埠,不是http.port的埠。

說三遍,因為我在這裡浪費了很多時間,好坑。

之後啟動節點2,好事會報錯。

[2017-04-05T20:08:52,854][WARN ][o.e.d.z.UnicastZenPing   ] [node-2] [1] failed send ping to {#zen_unicast_192.168.116.19:9300_0#}{agHBxAUVS6Kmm0T5wk4ylw}{192.168.116.19}{192.168.116.19:9300}
java.lang.IllegalStateException: handshake failed with {#zen_unicast_192.168.116.19:9300_0#}{agHBxAUVS6Kmm0T5wk4ylw}{192.168.116.19}{192.168.116.19:9300}
        at org.elasticsearch.transport.TransportService.handshake(TransportService.java:364) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.discovery.zen.UnicastZenPing$PingingRound.getOrConnect(UnicastZenPing.java:393) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.discovery.zen.UnicastZenPing$3.doRun(UnicastZenPing.java:500) [elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:596) [elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-5.2.2.jar:5.2.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_121]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
Caused by: org.elasticsearch.transport.RemoteTransportException: [node-1][192.168.116.19:9300][internal:transport/handshake]
Caused by: org.elasticsearch.ElasticsearchSecurityException: missing authentication token for action [internal:transport/handshake]
        at org.elasticsearch.xpack.security.support.Exceptions.authenticationError(Exceptions.java:39) ~[?:?]
        at org.elasticsearch.xpack.security.authc.DefaultAuthenticationFailureHandler.missingToken(DefaultAuthenticationFailureHandler.java:74) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$AuditableTransportRequest.anonymousAccessDenied(AuthenticationService.java:483) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$handleNullToken$13(AuthenticationService.java:315) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.handleNullToken(AuthenticationService.java:320) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.consumeToken(AuthenticationService.java:247) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$extractToken$5(AuthenticationService.java:223) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.extractToken(AuthenticationService.java:236) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$authenticateAsync$0(AuthenticationService.java:184) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$lookForExistingAuthentication$2(AuthenticationService.java:201) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lookForExistingAuthentication(AuthenticationService.java:213) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.authenticateAsync(AuthenticationService.java:180) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.access$000(AuthenticationService.java:142) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService.authenticate(AuthenticationService.java:114) ~[?:?]
        at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.inbound(ServerTransportFilter.java:142) ~[?:?]
        at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler.messageReceived(SecurityServerTransportInterceptor.java:296) ~[?:?]
        at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.transport.TcpTransport$RequestHandler.doRun(TcpTransport.java:1488) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.common.util.concurrent.EsExecutors$1.execute(EsExecutors.java:109) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.transport.TcpTransport.handleRequest(TcpTransport.java:1445) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.transport.TcpTransport.messageReceived(TcpTransport.java:1329) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:74) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341) ~[?:?]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) ~[?:?]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:280) ~[?:?]
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:396) ~[?:?]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341) ~[?:?]
        at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341) ~[?:?]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) ~[?:?]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) ~[?:?]
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:129) ~[?:?]
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:642) ~[?:?]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:527) ~[?:?]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:481) ~[?:?]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:441) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) ~[?:?]
        ... 1 more

錯誤是因為它ping不同主節點的IP地址192.168.116.19:9300。因為主節點我是安裝了x-pack,安裝x-pack後會有許可權問題。所以我們也要在節點2中安裝x-pack

手動安裝x-pack

校驗檔案:sha1

# 我存放的路徑是
/home/yutao/下載/x-pack-5.2.2.zip

# 手動安裝的方法

bin/elasticsearch-plugin install file:///home/yutao/下載/x-pack-5.2.2.zip
-> Downloading file:///home/yutao/下載/x-pack-5.2.2.zip
[=================================================] 100%   
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@     WARNING: plugin requires additional permissions     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.lang.RuntimePermission accessClassInPackage.com.sun.activation.registries
* java.lang.RuntimePermission getClassLoader
* java.lang.RuntimePermission setContextClassLoader
* java.lang.RuntimePermission setFactory
* java.security.SecurityPermission createPolicy.JavaPolicy
* java.security.SecurityPermission getPolicy
* java.security.SecurityPermission putProviderProperty.BC
* java.security.SecurityPermission setPolicy
* java.util.PropertyPermission * read,write
* java.util.PropertyPermission sun.nio.ch.bugLevel write
* javax.net.ssl.SSLPermission setHostnameVerifier
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.

Continue with installation? [y/N]y
-> Installed x-pack

中途會要你選擇 y就行了。

這時再啟動節點2,就不會報錯了,列印的日誌:

[[email protected] elasticsearch-5.2.2-node-2]$ bin/elasticsearch
[2017-04-05T20:15:29,324][INFO ][o.e.n.Node               ] [node-2] initializing ...
[2017-04-05T20:15:30,093][INFO ][o.e.e.NodeEnvironment    ] [node-2] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [11.1gb], net total_space [16.9gb], spins? [unknown], types [rootfs]
[2017-04-05T20:15:30,093][INFO ][o.e.e.NodeEnvironment    ] [node-2] heap size [1.9gb], compressed ordinary object pointers [true]
[2017-04-05T20:15:30,094][INFO ][o.e.n.Node               ] [node-2] node name [node-2], node ID [yfSXvGJfSU2iQxQ2Y1lKeg]
[2017-04-05T20:15:30,187][INFO ][o.e.n.Node               ] [node-2] version[5.2.2], pid[11478], build[f9d9b74/2017-02-24T17:26:45.835Z], OS[Linux/3.10.0-514.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_121/25.121-b13]
[2017-04-05T20:15:34,170][INFO ][o.e.p.PluginsService     ] [node-2] loaded module [aggs-matrix-stats]
[2017-04-05T20:15:34,177][INFO ][o.e.p.PluginsService     ] [node-2] loaded module [ingest-common]
[2017-04-05T20:15:34,177][INFO ][o.e.p.PluginsService     ] [node-2] loaded module [lang-expression]
[2017-04-05T20:15:34,178][INFO ][o.e.p.PluginsService     ] [node-2] loaded module [lang-groovy]
[2017-04-05T20:15:34,178][INFO ][o.e.p.PluginsService     ] [node-2] loaded module [lang-mustache]
[2017-04-05T20:15:34,178][INFO ][o.e.p.PluginsService     ] [node-2] loaded module [lang-painless]
[2017-04-05T20:15:34,178][INFO ][o.e.p.PluginsService     ] [node-2] loaded module [percolator]
[2017-04-05T20:15:34,178][INFO ][o.e.p.PluginsService     ] [node-2] loaded module [reindex]
[2017-04-05T20:15:34,178][INFO ][o.e.p.PluginsService     ] [node-2] loaded module [transport-netty3]
[2017-04-05T20:15:34,178][INFO ][o.e.p.PluginsService     ] [node-2] loaded module [transport-netty4]
[2017-04-05T20:15:34,179][INFO ][o.e.p.PluginsService     ] [node-2] loaded plugin [x-pack]
[2017-04-05T20:15:37,804][DEBUG][o.e.a.ActionModule       ] Using REST wrapper from plugin org.elasticsearch.xpack.XPackPlugin
[2017-04-05T20:15:39,012][INFO ][o.e.n.Node               ] [node-2] initialized
[2017-04-05T20:15:39,012][INFO ][o.e.n.Node               ] [node-2] starting ...
[2017-04-05T20:15:39,478][INFO ][o.e.t.TransportService   ] [node-2] publish_address {192.168.116.19:9301}, bound_addresses {192.168.116.19:9301}
[2017-04-05T20:15:39,485][INFO ][o.e.b.BootstrapChecks    ] [node-2] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[2017-04-05T20:15:46,771][INFO ][o.e.c.s.ClusterService   ] [node-2] detected_master {node-1}{_eiOwymETTyrge_hnrFEgw}{vT7PK-fLSOylFjkJ0VEtzQ}{192.168.116.19}{192.168.116.19:9300}, added {{node-1}{_eiOwymETTyrge_hnrFEgw}{vT7PK-fLSOylFjkJ0VEtzQ}{192.168.116.19}{192.168.116.19:9300},}, reason: zen-disco-receive(from master [master {node-1}{_eiOwymETTyrge_hnrFEgw}{vT7PK-fLSOylFjkJ0VEtzQ}{192.168.116.19}{192.168.116.19:9300} committed version [12]])
[2017-04-05T20:15:48,658][INFO ][o.e.l.LicenseService     ] [node-2] license [f6ae560a-735e-4546-af87-af87944d734f] mode [trial] - valid
[2017-04-05T20:15:48,979][INFO ][o.e.h.HttpServer         ] [node-2] publish_address {192.168.116.19:9201}, bound_addresses {192.168.116.19:9201}
[2017-04-05T20:15:48,979][INFO ][o.e.n.Node               ] [node-2] started
[2017-04-05T20:16:53,935][WARN ][o.e.m.j.JvmGcMonitorService] [node-2] [gc][74] overhead, spent [583ms] collecting in the last [1s]
[2017-04-05T20:17:33,979][INFO ][o.e.m.j.JvmGcMonitorService] [node-2] [gc][114] overhead, spent [404ms] collecting in the last [1s]

從列印日誌也可以看出:

[2017-04-05T20:15:46,771][INFO ][o.e.c.s.ClusterService   ] [node-2] detected_master {node-1}{_eiOwymETTyrge_hnrFEgw}{vT7PK-fLSOylFjkJ0VEtzQ}{192.168.116.19}{192.168.116.19:9300}, added {{node-1}{_eiOwymETTyrge_hnrFEgw}{vT7PK-fLSOylFjkJ0VEtzQ}{192.168.116.19}{192.168.116.19:9300},}, reason: zen-disco-receive(from master [master {node-1}{_eiOwymETTyrge_hnrFEgw}{vT7PK-fLSOylFjkJ0VEtzQ}{192.168.116.19}{192.168.116.19:9300} committed version [12]])

已經找到了主節點192.168.116.19:9300

測試是否成功:

http://192.168.116.19:9200/_cluster/health?pretty=true

{
  "cluster_name" : "yutao",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 2,
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 12,
  "active_shards" : 24,
  "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
}

(安裝x-pack後)內建的賬號:elastic密碼:changeme

這裡寫圖片描述

我這裡貼出我的主節點配置資訊:

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
cluster.name: yutao
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
node.master: true
node.data: true
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
network.host: 192.168.116.19
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
discovery.zen.ping.unicast.hosts: ["192.168.116.19:9300", "192.168.116.19:9301"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 3
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

節點2的配置:

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
cluster.name: yutao
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
node.name: node-2
node.master: false
node.data: true
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
network.host: 192.168.116.19
#
# Set a custom port for HTTP:
#
#http.port: 9200
http.port: 9201
# transport.tcp
transport.tcp.port: 9301
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
discovery.zen.ping.unicast.hosts: ["192.168.116.19:9300", "192.168.116.19:9301"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 3
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

這裡貼出網上一些配置解釋:

1:Elasticsearch叢集中的三種角色

master node:master幾點主要用於元資料(metadata)的處理,比如索引的新增、刪除、分片分配等。
data node:data 節點上儲存了資料分片。它負責資料相關操作,比如分片的 CRUD,以及搜尋和整合操作。這些操作都比較消耗 CPU、記憶體和 I/O 資源;
client node:client 節點起到路由請求的作用,實際上可以看做負載均衡器。
其對應的高效能叢集拓撲結構模式為:

# 配置檔案中給出了三種配置高效能叢集拓撲結構的模式,如下: 
# 1. 如果你想讓節點從不選舉為主節點,只用來儲存資料,可作為負載器 
# node.master: false 
# node.data: true 
# 2. 如果想讓節點成為主節點,且不儲存任何資料,並保有空閒資源,可作為協調器
# node.master: true
# node.data: false
# 3. 如果想讓節點既不稱為主節點,又不成為資料節點,那麼可將他作為搜尋器,從節點中獲取資料,生成搜尋結果等 
# node.master: false 
# node.data: false

2:config/elasticsearch.ymal中配置項說明

cluster_name 叢集名稱,預設為elasticsearch,這裡我們設定為es5.2.1Cluster
node.name配置節點名,用來區分節點
network.host 是配置可以訪問本節點的路由地址

http.port 路由地址埠
transport.tcp.port TCP協議轉發地址埠

node.master 是否作為叢集的主結點 ,值為true或true
node.data 是否儲存資料,值為true或true

discovery.zen.ping.unicast.hosts 用來配置所有用來組建叢集的機器的IP地址,由於5.2.1新版本是不支援多播的,因此這個值需要提前設定好,當叢集需要擴充套件的時候,該值都要做改變,增加新機器的IP地址,如果是在一個ip上,要把TCP協議轉發埠寫上

discovery.zen.minimum_master_nodes 用來配置主節點數量的最少值,如果主節點數量低於該值,閉包範圍內的叢集將會停止服務,之所以加粗體,是因為暫時尚未認證,下面配置為1方便叢集更容易形成,即使只有一個主節點,也可以構建叢集

gateway.* 閘道器的相關配置

script.* indices.* 根據需求新增的配置(可選)

相關推薦

centos7配置elasticsearch叢集離線安裝x-pack

環境 作業系統:win7 虛擬機器:centos7 elasticsearch:5.2.2 步驟 前提條件 由於我是自己學習用,筆記本的記憶體有限,所以想在一臺虛擬機器中配置叢集。 我虛擬機器的情況是,已經安裝好了elasticsearch

ElasticSearch Kibana Logstash 安裝x-pack記錄

perm file addition 需要 per run windows ati 操作系統 前言 最近用到了ELK的集群,想想還是用使用官方的x-pack的monitor功能對其進行監控,這裏先上圖看看: 環境如下: 操作系統: window 2012 R

如何在docker部署Elasticsearch叢集kibana

做實驗時需要了解Elasticsearch叢集如何操作?通過使用docker-compose可以批量建立docker容器,啟動ES叢集。 先配置檔案docker-compose.yml檔案如下: 1 version: '2.2' 2 networks: 3 esnet: 4 services:

oracle在centos7配置自啟動遠端連線(plsql)

先把幾個常見命令貼出來: 啟動監聽:lsnrctl start 檢視監聽:lsnrctl status 停止監聽:lsnrctl stop sqlplus "/as sysdba" 或者 sqlplus /nolog; connect /as

在Ubuntu 14.04安裝配置Elasticsearch叢集(最新5.5.2版)

安裝Elasticsearch 準備兩臺Ubuntu 14.04伺服器,在本例中分別為10.82.156.109和10.80.109.59。分別安裝Elasticsearch服務 安裝Oracle Java 8 sudo add-apt-repositor

docker探索-CentOS7配置Docker的yum源並升級安裝docker1.13(十)

strong tro extras 配置 1.7 arc client 1.8 1.2 此處使用的是CentOS7,內核版本為 [root@localhost ~]# uname -r 3.10.0-327.el7.x86_64 該版本下,配置了yum的源為阿裏的鏡像源

軟件安裝配置(ubuntu)——離線安裝node.jsnpm

ubuntu nod void www webpack rpd html help pack 參考鏈接: https://blog.csdn.net/topswim/article/details/79200936 http://www.360doc.com/content

centos7.5 mysql5.7 的解除安裝離線安裝全過程

根據之前的部落格可以安裝mysql5.7 ,但是考慮到有時候現場部署的環境沒有網路。那麼可能得離線安裝mysql5.7,那麼現在開始來嘗試一下吧。 1.解除安裝mysql5.7 (我也不清楚到底乾淨了麼) 1.1檢視系統版本 把資料庫停掉 [[email protected]

Eclipse常用外掛線上安裝離線安裝方式(不斷更新。。。)

 1.Subclipse 原始碼管理工具Subversion的Java客戶端,對使用Subversion做原始碼管理的,這個相信用的會比較多。預設使用JavaHL介面,如果使用中沒有問題的話,最好別切換 1)    從官網下載 2)    解壓至 ${eclipse}\

web.xml配置spring監聽器spring配置文件位置

nco erl spring XML param onf ati spa extc <!-- spring配置文件位置 --> <context-param> <param-name>contextConfigLocation</

centos7配置rsync+inotify實現自動監控數據同步

ping通 ping down 自動監控 type 用戶密碼 mark RoCE 關閉 rsync服務可以實現數據的同步,但不是自動同步,所以在一些網站服務等, 需要用到inotify進行自動監控。 實驗環境:centos7 兩臺 能互相ping通

centos7.5 kubernetes/k8s 1.10 離線安裝

自己 contain firewall web enable rom time 最簡 修改ip centos7.5 kubernetes/k8s 1.10 離線安裝 本文介紹在centos7.5使用kubeadm快速離線安裝kubernetes 1.10。采用單ma

centos7.3 kubernetes/k8s 1.10 離線安裝 --已驗證

using over expired eset local 筆記 方式 don boot 本文介紹在centos7.3使用kubeadm快速離線安裝kubernetes 1.10。 采用單master,單node(可以多node),占用資源較少,方便在筆記本或學習環境快速

Eclipse外掛springsource-tool-suite線上離線安裝步驟

springsource-tool-suite外掛是一個基於Eclipse的開發環境,為開發Spring應用程式而定製。它提供了一個即用的環境來實現,除錯,執行和部署Spring應用程式,包括Pivotal tc伺服器,Pivotal Cloud Foundry,Git,Maven,AspectJ的整合。

Linux系統的CentOS7配置jupyter並遠端登陸

前言 Jupyter是anaconda中自帶非常好用的python互動式筆記本,大部分人在windows下使用Juypter,開啟使用也是本地使用,那本文介紹的是如何在Linux下配置好Jupyter,並遠端登陸。 安裝Juypter 在linux中安裝jup

CentOS7配置網路連線

       剛在VMware安裝好的CentOS7,預設安裝是沒有開啟配置網絡卡資訊的,所以連不上網。嘗試用兩種配置來讓CentOS7開啟聯網功能,一種是直接開啟網路功能自動獲取ip,會在設定的網段下面隨機分配一個ip,另一種是設定固定ip,出於某些特殊的需求,例如要在區域

ElasticSearch叢集的外掛安裝

1.Head外掛安裝:     本篇部落格是在上一篇ElasticSearch叢集的搭建的基礎上來的,head是es的一個視覺化工具     憋說話!!!照著做:     #更新         sudo yum update -y         sudo rpm

Ubuntu16.04與ARM的NFS配置、掛載解除安裝

ip分配: 閘道器    192.168.137.1               電腦     192.168.137.4               Ubuntu 192.168.137.2               開發板  192.168.137.3 一:

eclipse配置tomcat伺服器埠被佔用問題的解決

1. 2. 3.如果出現埠被佔用的錯誤可以採取下面兩種解決方式 a.在改tomcat檔案加下找到conf資料夾,找到server.xml檔案把裡面的 port=8080改為其他一個數字。例如8000,7000. 相應的ecl

Springboot應用配置屬性類配置屬性項的對應關係總結

Spring boot應用工作時使用到的配置屬性來源自某個配置屬性bean,而這些配置屬性bean基於相應的配置屬性類和一組配置屬性項建立。下表總結了Spring boot應用中框架內建的用於建立配置屬性bean的配置屬性類和配置屬性項的對應關係 : 注意 1 : 這裡的配置