本篇內(nèi)容主要講解“elasticsearch6.7.1集群搭建步驟”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學(xué)習(xí)“elasticsearch6.7.1集群搭建步驟”吧!
10年的靖宇網(wǎng)站建設(shè)經(jīng)驗,針對設(shè)計、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時及時工作處理。營銷型網(wǎng)站建設(shè)的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動調(diào)整靖宇建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計,從而大程度地提升瀏覽體驗。創(chuàng)新互聯(lián)從事“靖宇網(wǎng)站設(shè)計”,“靖宇網(wǎng)站推廣”以來,每個客戶項目都認(rèn)真落實執(zhí)行。elasticsearch下載地址:ttps://github.com/elastic/elasticsearch/releases
ik下載地址:https://github.com/medcl/elasticsearch-analysis-ik/releases
1.下載解壓es和jdk包
[root@node1 ~]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.1.tar.gz
[root@node1 ~]# tar xvf elasticsearch-6.7.1.tar.gz -C /opt/
[root@node1 ~]# wget https://download.oracle.com/otn-pub/java/jdk/8u202-b08/1961070e4c9b4e26a04e7f5a083f551e/jdk-8u202-linux-x64.rpm?AuthParam=1552723272_02cde009ff2384cfcf01e2c377d085cc
[root@node1 ~]# scp jdk-8u202-linux-x64.rpm node2:/root/ --將jdk傳到各節(jié)點上
[root@node1 ~]# scp jdk-8u202-linux-x64.rpm node3:/root/ --將jdk傳到各節(jié)點上
[root@node1 ~]# rpm -ivh jdk-8u202-linux-x64.rpm --在各節(jié)點安裝jdk
[root@node1 ~]# cd /opt/elasticsearch-6.7.1/
[root@node1 elasticsearch-6.7.1]# useradd wuhan --創(chuàng)建es用戶,es不能用root用戶啟動
[root@node1 elasticsearch-6.7.1]# passwd wuhan
更改用戶 wuhan 的密碼 。
新的 密碼:
無效的密碼: 密碼少于 8 個字符
重新輸入新的 密碼:
passwd:所有的身份驗證令牌已經(jīng)成功更新。
[root@node1 elasticsearch-6.7.1]# chown -R wuhan:wuhan /opt/elasticsearch-6.7.1/
[root@node1 elasticsearch-6.7.1]# vim /etc/security/limits.conf
* soft nofile 65535
* hard nofile 65535
[root@node1 elasticsearch-6.7.1]# vim /etc/sysctl.conf
vm.max_map_count=262144
[root@node1 elasticsearch-6.7.1]# sysctl -p
[root@node1 elasticsearch-6.7.1]# vim /opt/elasticsearch-6.7.1/config/elasticsearch.yml
cluster.name: wuhan --設(shè)置集群節(jié)點名
node.name: node-1 --為每臺機器設(shè)置node名字,各節(jié)點名字不能一樣
path.data: /opt/elasticsearch-6.7.1/data --es數(shù)據(jù)目錄
path.logs: /opt/elasticsearch-6.7.1/logs --日志目錄
discovery.zen.ping.unicast.hosts: ["node1", "node2", "node3", "node4"]
network.host: 172.16.8.23 --綁定本機的IP地址
http.port: 9200 --指定端口
[root@node1 elasticsearch-6.7.1]#
2.將node1的es文件復(fù)制到其它節(jié)點(與node1配置一樣)
[root@node1 opt]# scp -r elasticsearch-6.7.1 node2:/opt/
[root@node1 opt]# scp -r elasticsearch-6.7.1 node3:/opt/
[root@node2 ~]# chown -R wuhan:wuhan /opt/elasticsearch-6.7.1/
[root@node2 ~]# vim /etc/security/limits.conf
* soft nofile 65535
* hard nofile 65535
[root@node2 ~]# vim /etc/sysctl.conf
vm.max_map_count=262144
[root@node2 ~]# sysctl -p
3.啟動各節(jié)點的es服務(wù)
[root@node1 ~]# su - wuhan
[wuhan@node1 ~]$ cd /opt/elasticsearch-6.7.1/bin/
[wuhan@node1 bin]$ ./elasticsearch -d
[wuhan@node1 bin]# curl http://172.16.8.23:9200
{
"name" : "node-1",
"cluster_name" : "wuhan",
"cluster_uuid" : "_na_",
"version" : {
"number" : "6.7.1",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "2f32220",
"build_date" : "2019-04-02T15:59:27.961366Z",
"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"
}
[wuhan@node1 bin]#
4.安裝head插件
[root@node1 ~]$ wget https://nodejs.org/dist/v11.13.0/node-v11.13.0-linux-x64.tar.xz
[root@node1 ~]$ tar xvf node-v11.13.0-linux-x64.tar.xz
[root@node1 ~]$ mv node-v11.13.0-linux-x64 /opt/node-v11.13.0
[root@node1 ~]$ vim /etc/profile
export PATH=$PATH:/opt/node-v11.13.0/bin
[root@node1 ~]$ git clone git://github.com/mobz/elasticsearch-head.git
[root@node1 ~]# cd elasticsearch-head/
[root@node1 elasticsearch-head]# npm install
npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 9 packages from 13 contributors and audited 1853 packages in 157.775s
found 33 vulnerabilities (19 low, 8 moderate, 6 high)
run `npm audit fix` to fix them, or `npm audit` for details
[root@node1 elasticsearch-head]# npm run start
> elasticsearch-head@0.0.0 start /root/elasticsearch-head
> grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100
5.修改es配置文件,重啟服務(wù)
[wuhan@node1 bin]# vim /opt/elasticsearch-6.7.1/config/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
[wuhan@node1 bin]$ jps
17849 Elasticsearch
17935 Jps
[wuhan@node1 bin]$ kill -9 17849
[wuhan@node1 bin]$ cd /opt/elasticsearch-6.7.1/bin
[wuhan@node1 bin]$ ./elasticsearch -d
6.訪問web頁面
[root@node1 elasticsearch-head]# grunt server &
[1] 20212
[root@node1 elasticsearch-head]#
錯誤提示:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.16 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.16 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-04-09T11_24_27_132Z-debug.log
解決方法:
[root@node1 elasticsearch-head]# npm install phantomjs-prebuilt@2.1.16 --ignore-scripts
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ phantomjs-prebuilt@2.1.16
added 62 packages from 64 contributors, removed 4 packages and audited 1717 packages in 20.487s
found 31 vulnerabilities (18 low, 7 moderate, 6 high)
run `npm audit fix` to fix them, or `npm audit` for details
[root@node1 elasticsearch-head]#
錯誤提示:
[2019-04-10T14:42:30,931][ERROR][o.e.b.Bootstrap ] [node-1] Exception
java.lang.IllegalArgumentException: Plugin [analysis-ik] was built for Elasticsearch version 6.7.0 but version 6.7.1 is running
at org.elasticsearch.plugins.PluginsService.verifyCompatibility(PluginsService.java:346) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.plugins.PluginsService.loadBundle(PluginsService.java:531) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:471) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.plugins.PluginsService.
at org.elasticsearch.node.Node.
at org.elasticsearch.node.Node.
解決方法:
ES和ik版本必須一至,否則會出錯
到此,相信大家對“elasticsearch6.7.1集群搭建步驟”有了更深的了解,不妨來實際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進入相關(guān)頻道進行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!