ELASTICSEARCH單播方式搭建

集群:

10.226.204.6昌简;10.226.204.8继阻;10.226.204.9

三臺機器配置好jdk示括,將es拷貝到每一臺機器上的相同目錄下(/home/elk/elasticsearch)

三個節(jié)點都不配置node.master和node.data姆怪,使用默認(rèn)配置

主要寫好配置文件/config/Elasticsearch.yml

以10.226.204.6為例:


# ======================== 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: jmr-elk 配置集群名稱溯乒,三臺的集群名稱要相同

#

# ------------------------------------ Node ------------------------------------

#

# Use a descriptive name for the node:

#

node.name: node-6 節(jié)點名稱杯道,不能相同

#

# 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: /home/elk/data 配置ES數(shù)據(jù)存儲路徑匪煌,默認(rèn)情況下,ES將數(shù)據(jù)存在ES根目錄下,注意這里一定要手動配置虐杯,否則重新部署ES時玛歌,數(shù)據(jù)將被清空

#

# Path to log files:

#

path.logs: /home/elk/log ES log路徑

#

# ----------------------------------- 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: 10.226.204.6 配置hostip地址

#

# Set a custom port for HTTP:

#

http.port: 9200 配置端口號,查詢和插入需要使用該端口號擎椰,注意支子,ES之間通信使用9300端口號,需要修改時达舒,需要使用transport.tcp.port:9300進行配置

#

# 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: ["10.226.204.8:9300","10.226.204.9:9300"] 這里列出部分集群節(jié)點值朋,如果不加端口號,默認(rèn)使用9300端口號巩搏,在10.226.204.6主機上昨登,這里只添加另外兩臺主機

#

# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):

#

discovery.zen.minimum_master_nodes: 2 最少有幾個master候選節(jié)點時,可選舉主節(jié)點贯底,數(shù)量是(N / 2) + 1, N是有資格成為Master的節(jié)點丰辣,防止出現(xiàn)腦裂現(xiàn)象

#

# 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

驗證集群搭建是否成功:curl -XGET 'http://10.226.204.6.:9200/_cat/nodes?pretty',可以查看到集群中節(jié)點狀態(tài)

踩得坑:

1禽捆、 discovery.zen.ping.multicast.enabled: false笙什,在ES2.X以后版本中,是不能對該屬性進行配置的胚想,目前最新的ES默認(rèn)使用單播模式進行集群搭建琐凭,如果使用多播模式搭建,需要新添加插件浊服,也不建議使用多播方式進行搭建统屈;

2、 ES啟動過程中出現(xiàn):max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]牙躺,解決方法如下:

a) 切換到root用戶

b) 執(zhí)行命令:

c) sysctl -w vm.max_map_count=262144

d) 查看結(jié)果:

e) sysctl -a|grep vm.max_map_count

f) 顯示:

g) vm.max_map_count = 262144

3愁憔、 centos7.2 es5.4.1啟動報錯 BindTransportException [Failed to bind to [9300-9400]],是由于配置文件里本機的ip地址寫錯了

參考鏈接:

1孽拷、 https://www.elastic.co/guide/cn/elasticsearch/guide/current/important-configuration-changes.html

2吨掌、 http://www.cnblogs.com/leeSmall/p/9220535.html

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市乓搬,隨后出現(xiàn)的幾起案子思犁,更是在濱河造成了極大的恐慌代虾,老刑警劉巖进肯,帶你破解...
    沈念sama閱讀 217,185評論 6 503
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異棉磨,居然都是意外死亡江掩,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,652評論 3 393
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來环形,“玉大人策泣,你說我怎么就攤上這事√б鳎” “怎么了萨咕?”我有些...
    開封第一講書人閱讀 163,524評論 0 353
  • 文/不壞的土叔 我叫張陵,是天一觀的道長火本。 經(jīng)常有香客問我危队,道長,這世上最難降的妖魔是什么钙畔? 我笑而不...
    開封第一講書人閱讀 58,339評論 1 293
  • 正文 為了忘掉前任茫陆,我火速辦了婚禮,結(jié)果婚禮上擎析,老公的妹妹穿的比我還像新娘簿盅。我一直安慰自己,他們只是感情好揍魂,可當(dāng)我...
    茶點故事閱讀 67,387評論 6 391
  • 文/花漫 我一把揭開白布桨醋。 她就那樣靜靜地躺著,像睡著了一般愉烙。 火紅的嫁衣襯著肌膚如雪讨盒。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,287評論 1 301
  • 那天步责,我揣著相機與錄音返顺,去河邊找鬼。 笑死蔓肯,一個胖子當(dāng)著我的面吹牛遂鹊,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播蔗包,決...
    沈念sama閱讀 40,130評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼秉扑,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了调限?” 一聲冷哼從身側(cè)響起舟陆,我...
    開封第一講書人閱讀 38,985評論 0 275
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎耻矮,沒想到半個月后秦躯,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,420評論 1 313
  • 正文 獨居荒郊野嶺守林人離奇死亡裆装,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,617評論 3 334
  • 正文 我和宋清朗相戀三年踱承,在試婚紗的時候發(fā)現(xiàn)自己被綠了倡缠。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,779評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡茎活,死狀恐怖昙沦,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情载荔,我是刑警寧澤盾饮,帶...
    沈念sama閱讀 35,477評論 5 345
  • 正文 年R本政府宣布,位于F島的核電站懒熙,受9級特大地震影響丐谋,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜煌珊,卻給世界環(huán)境...
    茶點故事閱讀 41,088評論 3 328
  • 文/蒙蒙 一号俐、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧定庵,春花似錦吏饿、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,716評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至畴博,卻和暖如春笨忌,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背俱病。 一陣腳步聲響...
    開封第一講書人閱讀 32,857評論 1 269
  • 我被黑心中介騙來泰國打工官疲, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人亮隙。 一個月前我還...
    沈念sama閱讀 47,876評論 2 370
  • 正文 我出身青樓途凫,卻偏偏與公主長得像,于是被迫代替她去往敵國和親溢吻。 傳聞我的和親對象是個殘疾皇子维费,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,700評論 2 354

推薦閱讀更多精彩內(nèi)容