系統(tǒng)centos6.7
網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)公司!專注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開(kāi)發(fā)、微信小程序開(kāi)發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了肇源免費(fèi)建站歡迎大家使用!1,安裝jdk-1.8.0
yum install java-1.8.0-openjdk
2,下載elasticsearch-2.4.3.tar.gz并安裝
tar zxvf elasticsearch-2.4.3.tar.gz -C /opt vi /opt/elasticsearch-2.4.3/conf/elasticsearch.yml
添加配置
network.host: 0.0.0.0#server綁定本地服務(wù)器內(nèi)外網(wǎng)ip http.cors.enabled: true http.cors.allow-origin: "*"
3,啟動(dòng)
報(bào)錯(cuò)
penJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:94)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:160)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:45)
Refer to the log for complete error details.
[root@vultr elasticsearch]# su es bin/elasticsearch
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
[2016-12-29 08:56:59,510][WARN ][bootstrap ] unable to install syscall filter: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
Exception in thread "main" java.lang.IllegalStateException: Unable to access 'path.plugins' (/opt/elasticsearch/plugins)
Likely root cause: java.nio.file.AccessDeniedException: /opt/elasticsearch/plugins
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
at java.nio.file.Files.createDirectory(Files.java:674)
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
at java.nio.file.Files.createDirectories(Files.java:767)
at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:337)
at org.elasticsearch.bootstrap.Security.addPath(Security.java:314)
at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:246)
at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:212)
at org.elasticsearch.bootstrap.Security.configure(Security.java:118)
at org.elasticsearch.bootstrap.Bootstrap.setupSecurity(Bootstrap.java:212)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:183)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:45)
Refer to the log for complete error details.
原因:1,新版本不允許用root啟動(dòng),2,軟件目錄沒(méi)相應(yīng)的權(quán)限
解決:
groupadd es useradd -g es es passwd es
重新啟動(dòng):
su es -c /opt/elasticsearch-2.4.3/bin/elasticsearch -Xmx2g -Xms2g - Des.index.storage.type=memory –d > /dev/null 2>&1 &” #因?yàn)槲矣玫氖翘摂M機(jī),內(nèi)存比較小,所以啟動(dòng)看實(shí)際情況 -Xmx2g 是大內(nèi)存 -Xms2g 是最小內(nèi)存 -d 是后臺(tái)運(yùn)行 #我的運(yùn)行命令是 su es -c /opt/elasticsearch/bin/elasticsearch –d > /dev/null 2>&1 &
安裝插件:elasticsearch-head(是集群前段顯示頁(yè)面)
切換到bin目錄下 執(zhí)行
./plugin install mobz/elasticsearch-head
頁(yè)面展示:http://localhost/_plugin/head
測(cè)試:
curl http://localhost:9200 出現(xiàn)一個(gè)json 數(shù)據(jù)表明啟動(dòng)成功,如下
{
"status": 200,
"name": "Omen",
"version": {
"number": "1.1.1",
"build_hash": "f1585f096d3f3985e73456debdc1a0745f512bbc",
"build_timestamp": "2014-04-16T14:27:12Z",
"build_snapshot": false,
"lucene_version": "4.7"
},
"tagline": "You Know, for Search"
}
安裝插件:elasticsearch-kopf
執(zhí)行命令:
./plugin install lmenezes/elasticsearch-kopf
頁(yè)面展示:http://localhost/_plugin/bigdesk/
4,安裝kibana
tar zxvf kibana-4.6.3-linux-x86_64.tar.gz -C /opt
修改配置
因?yàn)楹蚭lasticsearch 在同一臺(tái)服務(wù)器上,所以只需要修改elasticsearch的鏈接地址
elasticsearch_url: http://localhost:9200
啟動(dòng)
bin/kibana -p 5601 > /dev/null 2>&1 &
意思是以5601端口啟動(dòng)
然后以http://ip:5601訪問(wèn)就可以了
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。