溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

elk 安裝與所遇問題

發(fā)布時(shí)間:2020-07-31 03:07:35 來源:網(wǎng)絡(luò) 閱讀:7965 作者:wks97 欄目:系統(tǒng)運(yùn)維

系統(tǒng)centos6.7

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,軟件目錄沒相應(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(是集群前段顯示頁面)

切換到bin目錄下 執(zhí)行

./plugin install  mobz/elasticsearch-head

頁面展示: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

頁面展示: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訪問就可以了

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI