ElasticSearch 6.8.4安裝
centos7 下安裝 ElasticSearch 6.8.4
下載相應的安裝包
elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.4.tar.gz
kibana
wget https://artifacts.elastic.co/downloads/kibana/kibana-6.8.4-linux-x86_64.tar.gz
外掛elasticsearch-analysis-ik
可選外掛wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.8.4/elasticsearch-analysis-ik-6.8.4.zip
JDK1.8
jdk-8u201-linux-x64.tar.gz
安裝
tar -zxvf ...tar.gz
解壓相應的壓縮包
[root@centos local]# ls
elasticsearch-6.8.4 jdk1.8.0_201 kibana-6.8.4-linux-x86_64
複製程式碼
JDK安裝
配置JDK環境變數,編輯/etc/profile,追加
export JAVA_HOME=/usr/local/jdk1.8.0_201
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
複製程式碼
儲存之後,是環境變數生效
source /etc/profile
安裝elasticsearch
es不允許root啟動,所以新建使用者用於啟動es
建立es使用者
useradd es
調整es kibana目錄許可權
chown -R es:es elasticsearch-6.8.4
chown -R es:es kibana-6.8.4-linux-x86_64
複製程式碼
系統配置調整
調整每個程式最大同時開啟檔案數,最大執行緒個數
修改/etc/security/limits.conf檔案,增加配置,需要重新進行登入才能生效
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
複製程式碼
修改/etc/sysctl.conf檔案,增加配置
vm.max_map_count=262144
複製程式碼
sysctl -p
執行命令生效
否則可能會出現以下錯誤
ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low,increase to at least [65535]
[2]: max number of threads [3796] for user [es] is too low,increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low,increase to at least [262144]
複製程式碼
調整es啟動記憶體
vim elasticsearch-6.8.4/config/jvm.options
根據自己機器配置,設定jvm記憶體
-Xms256m
-Xmx256m
複製程式碼
調整es啟動配置
vim elasticsearch-6.8.4/config/elasticsearch.yml
有需要的話可以調整該配置檔案
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.1.130
#
# Set a custom port for HTTP:
#
http.port: 9200
複製程式碼
啟動
切換es使用者,su es
,執行命令elasticsearch-6.8.4/bin/elasticsearch
後臺啟動elasticsearch-6.8.4/bin/elasticsearch -d
驗證是否啟動
瀏覽器輸入http://192.168.1.130:9200
能夠輸出如下資訊,表示啟動成功
{
name: "vsSQQTr",cluster_name: "elasticsearch",cluster_uuid: "2ah6hJ_WQLC9XoNvo0wJtg",version: {
number: "6.8.4",build_flavor: "default",build_type: "tar",build_hash: "bca0c8d",build_date: "2019-10-16T06:19:49.319352Z",build_snapshot: false,lucene_version: "7.7.2",minimum_wire_compatibility_version: "5.6.0",minimum_index_compatibility_version: "5.0.0"
},tagline: "You Know,for Search"
}
複製程式碼
到此, 單機版安裝就完成了
開啟許可權認證
elasticsearch 6.8以後集成了x-pack,不需要再安裝x-pack外掛,直接啟用即可
修改配置檔案vim elasticsearch-6.8.4/config/elasticsearch.yml
增加以下配置
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
複製程式碼
啟動es elasticsearch-6.8.4/bin/elasticsearch
新開一個ssh視窗,執行elasticsearch-6.8.4/bin/elasticsearch-setup-passwords interactive
設定相關密碼
[es@vmcentos bin]$ ./elasticsearch-setup-passwords interactive
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y
Enter password for [elastic]:
Reenter password for [elastic]:
Enter password for [apm_system]:
Reenter password for [apm_system]:
Enter password for [kibana]:
Reenter password for [kibana]:
Enter password for [logstash_system]:
Reenter password for [logstash_system]:
Enter password for [beats_system]:
Reenter password for [beats_system]:
Enter password for [remote_monitoring_user]:
Reenter password for [remote_monitoring_user]:
Changed password for user [apm_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]
複製程式碼
安裝Kibana
修改kibana-6.8.4-linux-x86_64/config/kibana.yml 配置
server.host: "192.168.1.130"
elasticsearch.hosts: ["http://192.168.1.130:9200"]
# 上一步生成的elastic賬號密碼
elasticsearch.username: "elastic"
elasticsearch.password: "123456"
複製程式碼
啟動Kibana
kibana-6.8.4-linux-x86_64/bin/kibana
訪問http://192.168.1.130:5601
如果希望Kibana介面使用中文,調整多語言配置,編輯kibana-6.8.4-linux-x86_64/config/kibana.yml
# 多語言設定為中文
i18n.locale: "zh-CN"
複製程式碼
分享一個kibana後臺啟動的命令
mkdir kibana-6.2.2-linux-x86_64/logs
mkdir kibana-6.2.2-linux-x86_64/pid
nohup kibana-6.2.2-linux-x86_64/bin/kibana >> kibana-6.2.2-linux-x86_64/logs/kibana.log 2>&1 & echo $! > /kibana-6.2.2-linux-x86_64/pid/kibana.pid
複製程式碼
到此,Kibana安裝結束
elasticsearch + x-pack + Kibana 6.8版本安裝結束
安裝分詞外掛
#離線
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.8.4/elasticsearch-analysis-ik-6.8.4.zip
#./elasticsearch-plugin install file://ik的檔案路徑
./elasticsearch-plugin install file:///usr/local/elasticsearch-analysis-ik-6.8.4.zip
#線上
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.8.4/elasticsearch-analysis-ik-6.8.4.zip
複製程式碼
安裝日誌資訊
[es@centos bin]$ ./elasticsearch-plugin install file:///usr/local/elasticsearch-analysis-ik-6.8.4.zip
-> Downloading file:///usr/local/elasticsearch-analysis-ik-6.8.4.zip
[=================================================] 100%
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: plugin requires additional permissions @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.net.SocketPermission * connect,resolve
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.
Continue with installation? [y/N]y
-> Installed analysis-ik
複製程式碼
移除外掛
#elasticsearch-plugin remove [pluginname]
elasticsearch-plugin remove analysis-ik
複製程式碼
重啟es、kibana