ES單機配置及運行_1

Elasticsearch是一款開源、分佈式並提供RESTful風格api的搜索引擎

1、下載最新版本的elasticsearch,當前版本7.6.1

官網下載地址:https://www.elastic.co/cn/downloads/elasticsearch
Mac版本網盤地址:https://pan.baidu.com/s/10MywNUZxAajDToVKSdVcTA 密碼:qop9

2、解壓安裝包:
$ tar -xzvf elasticsearch-7.6.1-xxxx.tar.gz

定位到解壓目錄elasticsearch-7.6.1soft-dir
進入config目錄修改elasticsearch.yml文件

# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.seed_hosts: ["192.168.1.3", "[::1]"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["192.168.1.3"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

需要關注的幾個參數:http.port、discovery.seed_hosts、cluster.initial_master_nodes,啓動之時可能出現幾個錯誤,調整這幾個配置參數就ok

3、服務啓動

定位到啓動腳本,執行以下語句:

./bin/elasticsearch -d -p pid

-d表示以守護進程啓動,-p pid 表示記錄進程pid到pid文件當中;當出現下面的日誌表示es啓動成功,可以通過訪問服務啓動端口訪問,默認本機9200端口: http://localhost:9200
run-success
you-know
另外該啓動腳本支持輸入參數,常用的參數有-V(顯示版本信息)及-d(以守護進程運行),更多信息參照下圖
run-args

4、服務停止

1、通過pkill來結束進程:

$ pkill -F pid

2、可通過是用jps命令或ps命令查看es進程pid,再使用kill命令結束進程:

$ jps | grep Elasticsearch
$ ps -ef | grep Elasticsearch
$ kill -SIGTERM pid

jps
ps
使用kill結束進程,若此時直接啓動將失敗,因爲無法獲取到節點的鎖(可修改參數配置多個節點構成集羣,本次不討論)
node-lock

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章