Centos7.3部署Elasticsearch5.4.0集群-創(chuàng)新互聯(lián)

一、 安裝JDK

創(chuàng)新互聯(lián)堅持“要么做到,要么別承諾”的工作理念,服務領域包括:網(wǎng)站建設、網(wǎng)站設計、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務,滿足客戶于互聯(lián)網(wǎng)時代的電白網(wǎng)站設計、移動媒體設計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡建設合作伙伴!

1.1下載安裝

cd /usr/local/src

tar -zxvf jdk-8u131-linux-x64.tar.gz

mv jdk1.8.0_131 /usr/local/java

1.2修改配置文件

vim /etc/profile????????????????????? //最后面添加

export?JAVA_HOME=/usr/local/java CLASSPATH=/usr/local/java/lib/dt.jar/usr/local/java/lib/tools.jar PATH=/usr/local/java/bin:$PATH export?PATH?JAVA_HOMECLASSPATH

source /etc/profile???? //導入配置文件

java -version ? ? ? ? ? ? ?//查看java版本

二、安裝Elasticsearch


官網(wǎng):https://www.elastic.co/downloads

參考:http://blog.csdn.net/u013365215/article/details/70159159

2.1下載安裝

cd /usr/local/src/

curl -L -O?https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.0.tar.gz

tar -xvf elasticsearch-5.4.0.tar.gz

mv elasticsearch-5.4.0 /usr/local/

cd /usr/local/elasticsearch-5.4.0/

2.2系統(tǒng)調(diào)優(yōu)

1)配置系統(tǒng)大打開文件描述符數(shù)

vim /etc/sysctl.conf

vm.max_map_count?=?262144

執(zhí)行以下命令生效

sysctl -p

2)配置進程大打開文件描述符

vim /etc/security/limits.conf?????????? //文件最后

*?soft?nofile?65536 *?hard?nofile?65536

2.3編寫ES Master節(jié)點配置文件

vim config/elasticsearch.yml

cluster.name:?my-es node.name:?node-1 network.host:?192.168.19.141 http.port:?9200 transport.tcp.port:?9300 discovery.zen.ping.unicast.hosts:?["192.168.19.141","192.168.19.142","192.168.19.143"] discovery.zen.minimum_master_nodes:?2 #避免出現(xiàn)跨域問題 http.cors.enabled:?true http.cors.allow-origin:?"*"

第二個、第三個節(jié)點的配置只需修改成對應的即可。

2.4啟動ES

用root賬號啟動會報錯:java.lang.RuntimeException: can not runelasticsearch as root

Centos7.3部署Elasticsearch5.4.0集群

? ? ? ? ? ? ? ? ? ? ??

因為Elasticsearch6.0之后,不能使用root賬戶啟動,我們先創(chuàng)建一個elasticsearch組和賬戶:

groupadd elsearch

useradd elsearch -g elsearch -p elasticsearch

chown -R elsearch.elsearch /usr/local/elasticsearch-5.4.0/

后臺啟動:

su - elsearch -c "/usr/local/elasticsearch-5.4.0/bin/elasticsearch -d"

Centos7.3部署Elasticsearch5.4.0集群

2.5安裝head開源插件

參考:http://blog.csdn.net/ronmy/article/details/63685254

只在master上安裝插件即可。elasticsearch6不可以直接通過plugin -install mobz/elasticsearch-head安裝,并且head需要在node環(huán)境下運行,具體步驟如下:

第一步:安裝node

curl -sL -o /etc/yum.repos.d/khara-nodejs.repohttps://copr.fedoraproject.org/coprs/khara/nodejs/repo/epel-7/khara-nodejs-epel-7.repo

yum install -y nodejs nodejs-npm

查看安裝版本

Centos7.3部署Elasticsearch5.4.0集群

第二步:安裝grunt

cd /usr/lib/node_modules/npm/

npm install grunt-cli

npm install grunt

查看版本:

/usr/lib/node_modules/npm/node_modules/.bin/grunt -version

Centos7.3部署Elasticsearch5.4.0集群

第三步:安裝head

yum install -y git

cd /usr/local/

git clone git://github.com/mobz/elasticsearch-head.git

cd elasticsearch-head/

npm install

注意:這步可以會有一些報錯信息,可以忽略。

vim _site/app.js

#?修改?『http://localhost:9200』字段到本機ES端口與IP

Centos7.3部署Elasticsearch5.4.0集群

第四步:啟動head并在后臺運行

./node_modules/grunt/bin/gruntserver &

Centos7.3部署Elasticsearch5.4.0集群

瀏覽器訪問:

Centos7.3部署Elasticsearch5.4.0集群

注意:若不能形成集群,可能是 iptables 或者 selinux 的原因

2.6開機自啟

vim /etc/rc.local

su?-?elsearch?-c?"/usr/local/elasticsearch-5.3.1/bin/elasticsearch?-d" /usr/local/elasticsearch-head/node_modules/grunt/bin/grunt?server?&

保存退出后,給自啟文件賦予執(zhí)行權限(若不加,Centos7不會開機執(zhí)行)

chmod +x /etc/rc.d/rc.local


另外有需要云服務器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

網(wǎng)頁標題:Centos7.3部署Elasticsearch5.4.0集群-創(chuàng)新互聯(lián)
本文鏈接:http://muchs.cn/article30/csjgpo.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供電子商務、企業(yè)網(wǎng)站制作、域名注冊、動態(tài)網(wǎng)站、營銷型網(wǎng)站建設、網(wǎng)站建設

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化