(3)安裝elastic6.1.3及插件kibana,x-pack,essql,head,bigdesk,cerebro,ik
- 6安裝nginx
6.1安裝nginx
安裝 pcre,zlib,openssl,nginx
6.2生成web訪問用戶密碼
htpasswd –c –b /usr/local/nginx/conf/passwd/kibana.passwd user pass123
6.3 配置代理轉發
vim /usr/local/nginx/conf/nginx.conf #在配置文件末尾追加如下配置 #kibana server { listen 8890; root /usr/local/nginx/html; auth_basic "Kibana Auth"; auth_basic_user_file /usr/local/nginx/conf/passwd/kibana.passwd; location / { proxy_pass http://192.168.1.1:5601; proxy_redirect off; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } #cerebro server { listen8889; root /usr/local/nginx/html; auth_basic "Kibana Auth"; auth_basic_user_file /usr/local/nginx/conf/passwd/kibana.passwd; location / { proxy_pass http://192.168.1.1:9109; proxy_redirect off; } error_page 404 /404.html; location = /40x.html { } error_page500 502 503 504 /50x.html; location = /50x.html { } } #bigdesk server { listen 8886 root /usr/local/nginx/html; auth_basic "Kibana Auth"; auth_basic_user_file /usr/local/nginx/conf/passwd/kibana.passwd; location / { proxy_pass http://192.168.1.1:9106; proxy_redirect off; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } #head server { listen 8887; root /usr/local/nginx/html; auth_basic "Kibana Auth"; auth_basic_user_file /usr/local/nginx/conf/passwd/kibana.passwd; location / { proxy_pass http://192.168.1.1:9107; proxy_redirect off; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } #es-sql server { listen 8888; root /usr/local/nginx/html; auth_basic "Kibana Auth"; auth_basic_user_file /usr/local/nginx/conf/passwd/kibana.passwd; location / { proxy_pass http://192.168.1.1:9108; proxy_redirect off; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }
6.4配置首頁
由於每個插件的端口都不同,不方便訪問。自己做了一個首頁來訪問插件。
修改index.html
vim /usr/local/nginx/html/index.html
<!DOCTYPE html> <html> <head> <title>Elastic-Plugins</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome!</h1> <p> <a href="http://10.16.29.202:8890">kibana</a>.<br/> <p> <a href="http://10.16.29.202:8889">cerebro</a>.<br/> <p> <a href="http://10.16.29.202:8888">es-sql</a>.<br/> <p> <a href="http://10.16.29.202:8887">head</a>.<br/> <p> <a href="http://10.16.29.202:8886">bigdesk</a>.<br/> <p> <a href="http://10.16.29.202:8885">HQ</a>.<br/> </body> </html>
6.5啟動nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
6.6訪問nginx主頁,使用插件。密碼驗證:用戶user密碼pass123
6.7安裝遇到問題:
Nginx: error while loading shared libraries: libpcre.so.1解決
解決辦法:
http://blog.csdn.net/ystyaoshengting/article/details/50504746
問題分析:
在redhat 64位機器上, nginx可能讀取的pcre文件為/lib64/libpcre.so.1文件.
所以需要在/lib64/下建立軟連接:
ln -s /usr/local/lib/libpcre.so.1 /lib64/
- 7x-pack破解
7.1創建LicenseVerifier.java文件
package org.elasticsearch.license; import java.nio.*; import java.util.*; import java.security.*; import org.elasticsearch.common.xcontent.*; import org.apache.lucene.util.*; import org.elasticsearch.common.io.*; import java.io.*; public class LicenseVerifier { public static boolean verifyLicense(final License license, final byte[] encryptedPublicKeyData) { return true; } public static boolean verifyLicense(final License license) { return true; } }
7.2編譯LicenseVerifier.class
javac -cp "/home/ilog/elasticsearch-6.1.3/lib/elasticsearch-6.1.3.jar:/home/ilog/elasticsearch-6.1.3/lib/lucene-core-7.1.0.jar:/home/ilog/elasticsearch-6.1.3/plugins/x-pack/x-pack-6.1.3.jar" LicenseVerifier.java
7.3重新打包x-pack- 6.1.3.jar
解壓x-pack/x-pack-6.1.3.jar包,替換jar包中的LicenseVerifier.class文件,重新打包
#創建temp-dir臨時目錄,解壓jar包到臨時目錄
mkdir temp-jar cp /home/ilog/elasticsearch-6.1.3/plugins/x-pack/x-pack-6.1.3.jar temp-jar cd temp-jar jar -xvf x-pack-6.1.3.jar rm -rf x-pack-6.1.3.jar #拷貝自己創建的class文件到org/elasticsearch/license/目錄 cp LicenseVerifier.class org/elasticsearch/license/ #重新打包 jar -cvf x-pack-6.1.3.jar ./* #將jar包覆蓋到原目錄 cp x-pack-6.1.3.jar /home/ilog/elasticsearch-6.1.3/plugins/x-pack/x-pack-6.1.3.jar
7.4重啟elastic和kibana
bin/elasticsearch -d
bin/kibana &
7.5創建license文件,並上傳(白金版,license到2050年)
vim platimum.json {"license":{"uid":"e77971c5-c37e-42c8-b622-c22a9f9ee51c","type":"platinum","issue_date_in_millis":1520899200000,"expiry_date_in_millis":2524579200999,"max_nodes":100,"issued_to":"user123","issuer":"Web Form","signature":"abcdef","start_date_in_millis":1520899200000}}
7.6登錄kibana上傳license頁面,上傳license文件。
license上傳地址:http://192.168.1.1:5601/app/kibana#/management/elasticsearch/license_management/upload_license
- 8生產環境沒有互聯網如何安裝elastic插件
遇到的問題:安裝npm,grunt需要聯網,x-pack安裝需要聯網。其他都可以離線安裝。
解決問題前提條件:有可以上網的測試機器。在測試環境上按以上步驟安裝完所有插件
解決辦法:
8.1在測試環境安裝x-pack後,打包安裝x-pack後的elastic目錄,放到生產環境使用即可
8.2在測試環境安裝node後,打包整個node目錄,拷貝到生產環境,配置環境變量,即可使用node和grunt來啟動essql和head
(3)安裝elastic6.1.3及插件kibana,x-pack,essql,head,bigdesk,cerebro,ik