Let’s download the elasticsearch-7.1.1-darwin-x86_64.tar.gznode
as follows:linux
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.1-darwin-x86_64.tar.gz
Then extract it as follows:(而後解壓)bootstrap
tar -xzf elasticsearch-7.1.1-darwin-x86_64.tar.gz
It will then create a bunch of files and folders in your current directory. We then go into the bin directory as follows:(進入bin 目錄)vim
cd elasticsearch-7.1.1/bin
And now we are ready to start our node and single cluster:(啓動程序)瀏覽器
./elasticsearch
-d
./elasticsearch -d
測試 Elasticsearch 是否啓動成功,能夠打開另外一個終端,執行如下操做:安全
curl 'http://localhost:9200/?pretty'
注意事項:
1. elasticsearch 是不能用root 用戶啓動的,(緣由:因爲Elasticsearch能夠輸入且執行腳本,爲了系統安全,不容許使用root啓動;咱們看看有沒有可用的用戶),因此要用一個權限不是root的用戶啓動
//添加分組 deng
groupadd deng服務器
//添加用戶xing,分組在deng,密碼xing123
useradd xing -g deng -p xing123
//受權 elasticsearch-7.1.1目錄下的文件擁有者爲 xing(用戶):deng(分組)
chown -R xing:deng elasticsearch-7.1.1
切換用戶: su xing 而後啓動 ./bin/elasticsearchcurl
端口號放開和host 修改:jvm
jvm.options 中默認配置修改成:
運行 elasticsearch
./bin/elasticsearch -d 後臺啓動
*. 解決 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
緣由:max_map_count這個參數就是容許一個進程在VMAs(虛擬內存區域)擁有最大數量,VMA是一個連續的虛擬地址空間,當進程建立一個內存映像文件時VMA的地址空間就會增長,當達到max_map_count了就是返回out of memory errors。
出現這個問題,咱們須要切換到root用戶下
// 修改下面的文件 裏面是一些內核參數
vi /etc/sysctl.conf
//添加如下配置
vm.max_map_count=655360
添加完後保存,而後執行
sysctl -p
//-p 從指定的文件加載系統參數,如不指定即從/etc/sysctl.conf中加載
* 解決 max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
緣由:最大文件打開數量過小,出現此錯誤,切換到root用戶下,修改limits.conf
// 編輯此文件
[root@izbp163wlhi02tcaxyuxb7z /]# vim etc/security/limits.conf
在文件後加上
* soft nofile 65536
* hard nofile 65536
進入 /etc/security/limits.d 這個目錄下, 修改 vim 20-nproc.conf 文件
問題: ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
這時候編輯elasticsearch.yml文件,將 #cluster.initial_master_nodes: ["node-1", "node-2"] 修改成 cluster.initial_master_nodes: ["node-1"],保存。
測試 Elasticsearch 是否啓動成功,能夠打開另外一個終端,執行如下操做:
curl 'http://localhost:9200/?pretty'
咱們須要在後臺啓動,這樣當咱們退出時,應用仍在後臺運行
[xing@izuf6ezkmfgg9r7jkfcp3oz elasticsearch-7.1.1]$ ./bin/elasticsearch -d
中止後臺服務
前臺啓動,直接ctrl+c退出便可,後臺啓動,中止時能夠直接殺掉進程
[xing@izuf6ezkmfgg9r7jkfcp3oz elasticsearch-7.1.1]$ jps
32644 Elasticsearch
1206 Jps
[xing@izuf6ezkmfgg9r7jkfcp3oz elasticsearch-7.1.1]$ kill -9 32644
[xing@izuf6ezkmfgg9r7jkfcp3oz elasticsearch-7.1.1]$
總結:
1. 官方地址:https://www.elastic.co/downloads/past-releases 我這裏安裝在linux環境,下載tar包,下載完後解壓: tar -zxvf elasticsearch-7.1.1-linux-x86_64.tar.gz 2. 在 config目錄下 vim jvm.options 修改 將 -Xms2g -Xmx2g 改成 -Xms512m -Xmx512m 3. 添加權限 //添加分組 deng groupadd deng //添加用戶xing,分組在deng,密碼xing123 useradd xing -g deng -p xing123 //受權 /elasticsearch 目錄下的文件擁有者爲 xing(用戶):deng(分組) chown -R xing:deng elasticsearch/ 4. 開放端口和綁定地址 vim elasticsearch.yml 將network.host放開,修改成0.0.0.0下,將http.port放開,以下: # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # #network.host: 192.168.0.1 network.host: 0.0.0.0 # # Set a custom port for HTTP: # http.port: 9200 # # For more information, consult the network module documentation. 5. 修改配置參數 5.1 // 修改下面的文件 裏面是一些內核參數 vi /etc/sysctl.conf //添加如下配置 vm.max_map_count=655360 添加完後保存,而後執行 sysctl -p //-p 從指定的文件加載系統參數,如不指定即從/etc/sysctl.conf中加載 5.2 / 編輯此文件 [root@izbp163wlhi02tcaxyuxb7z /]# vim etc/security/limits.conf 在文件後加上 * soft nofile 65536 * hard nofile 65536 5.5.3版本,此文件有這幾個值,咱們只須要把這幾個值從65535改成65536便可。 # End of file root soft nofile 65536 root hard nofile 65536 * soft nofile 65536 * hard nofile 65536 6. 後臺啓動Elasticsearch 切換到xing 用戶下啓動(root 用戶不能啓動) [root@izuf6ezkmfgg9r7jkfcp3oz elasticsearch-7.1.1]# su xing [xing@izuf6ezkmfgg9r7jkfcp3oz elasticsearch-7.1.1]$ ./bin/elasticsearch -d 關閉 中止後臺服務 前臺啓動,直接ctrl+c退出便可,後臺啓動,中止時能夠直接殺掉進程 [wang@izbp163wlhi02tcaxyuxb7z bin]$ ./elasticsearch -d [wang@izbp163wlhi02tcaxyuxb7z bin]$ jps 3697 Elasticsearch 3771 Jps [wang@izbp163wlhi02tcaxyuxb7z bin]$ kill -9 3697
2. 安裝kibana
每個版本的es都有一個對應的Kibana版本,咱們能夠去下面的地址查找最新的版本,建議和es相同版本;
下載地址:https://www.elastic.co/downloads/past-releases
wget https://artifacts.elastic.co/downloads/kibana/kibana-7.1.1-linux-x86_64.tar.gz
//解壓:
tar -zxvf kibana-7.1.1-linux-x86_64.tar.gz
啓動: ./bin/kibana
kibana默認是在前臺啓動,能夠經過ctrl+c命令中止。
他會默認去連接同一臺服務器上的9200端口提供的服務,若是沒有啓動elasticSearch服務,他會一直嘗試去鏈接,咱們啓動下elasticSearch
1. 修改配置開放端口
咱們放開端口,放開server.host,並修改以下:
server.port: 5601
server.host: 0.0.0.0
2. kibana後臺啓動
當使用前臺啓動時,若是咱們退出終端,服務就會中止,咱們可使用nohup命令來啓動;
[root@izbp163wlhi02tcaxyuxb7z kibana-5.5.3-linux-x86_64]# nohup ./bin/kibana &
nohup命令:若是你在運行一個進程,你但願在退出帳戶或者關閉終端時繼續運行相應的進程,就可使用nohup(no hang up);該命令格式爲:nohup command &
暫停:
ps -ef | grep kibana
或者 ps -ef | grep 5601
或者 ps -ef | grep node
而後 kill -9 29063 就能夠暫停kibana
瀏覽器訪問爲:http://ip:5601/ 就看到以下界面了
安裝完成