亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

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

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Elasticsearch集群是怎么搭建的

發布時間:2021-12-13 10:46:53 來源:億速云 閱讀:182 作者:柒染 欄目:互聯網科技

Elasticsearch集群是怎么搭建的,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

一:資源

集群: gh-cluster

節點1:gh-cluster-node-01   10.44.66.2

節點2:gh-cluster-node-02   10.116.148.103

節點3:gh-cluster-node-03   10.170.142.108

Elasticsearch:elasticsearch-2.4.4.tar.gz

安裝目錄:/mnt/gh

二:安裝 Elasticsearch

1.創建相關文件目錄 

mkdir -p /mnt/gh/data/logs/elasticsearch
mkdir -p /mnt/gh/data/elasticsearch/{data,work,plugins,scripts}

2.創建新的用戶

groupadd elsearch
useradd elsearch -g elsearch -p elsearch

3.操作權限

chown -R elsearch:elsearch /mnt/gh/data/logs/elasticsearch /mnt/gh/data/elasticsearch

4.安裝 Elasticsearch

tar -zxvf elasticsearch-2.4.4.tar.gz

5./etc/security/limits.conf 配置

elsearch soft memlock unlimited
elsearch hard memlock unlimited

6.Elasticsearch 配置

vi /mnt/gh/elasticsearch-2.4.4/config/elasticsearch.yml 


點擊(此處)折疊或打開

  1. # ======================== Elasticsearch Configuration =========================

  2. #

  3. # NOTE: Elasticsearch comes with reasonable defaults for most settings.

  4. # Before you set out to tweak and tune the configuration, make sure you

  5. #       understand what are you trying to accomplish and the consequences.

  6. #

  7. # The primary way of configuring a node is via this file. This template lists

  8. # the most important settings you may want to configure for a production cluster.

  9. #

  10. # Please see the documentation for further information on configuration options:

  11. # <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>

  12. #

  13. # ---------------------------------- Cluster -----------------------------------

  14. #

  15. # Use a descriptive name for your cluster:

  16. #

  17.   cluster.name: gh-cluster

  18. #

  19. # ------------------------------------ Node ------------------------------------

  20. #

  21. # Use a descriptive name for the node:

  22. #

  23.   node.name: gh-cluster-node-01

  24. #

  25. # Add custom attributes to the node:

  26. #

  27. # node.rack: r1

  28. #

  29. # ----------------------------------- Paths ------------------------------------

  30. #

  31. # Path to directory where to store the data (separate multiple locations by comma):

  32.   path.data: /mnt/gh/data/elasticsearch/data

  33. #

  34. # Path to log files:

  35. #

  36.   path.logs : /mnt/gh/data/logs/elasticsearch

  37.   path.plugins: /mnt/gh/data/elasticsearch/plugins

  38.   path.scripts: /mnt/gh/data/elasticsearch/scripts

  39. #

  40. # ----------------------------------- Memory -----------------------------------

  41. #

  42. # Lock the memory on startup:

  43. #

  44.   bootstrap.memory_lock: true

  45. #

  46. # Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory

  47. # available on the system and that the owner of the process is allowed to use this limit.

  48. #

  49. # Elasticsearch performs poorly when the system is swapping the memory.

  50. #

  51. # ---------------------------------- Network -----------------------------------

  52. #

  53. # Set the bind address to a specific IP (IPv4 or IPv6):

  54. #

  55.   network.host: 10.44.66.2

  56. #

  57. # Set a custom port for HTTP:

  58. #

  59.   http.port: 9200

  60. #

  61. # For more information, see the documentation at:

  62. # <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>

  63. #

  64. # --------------------------------- Discovery ----------------------------------

  65. #

  66. # Pass an initial list of hosts to perform discovery when new node is started:

  67. # The default list of hosts is ["127.0.0.1", "[::1]"]

  68. #

  69.   discovery.zen.ping.multicast.enabled: false

  70.   discovery.zen.ping_timeout: 120s

  71.   discovery.zen.fd.ping_timeout: 120s

  72.   discovery.zen.ping.unicast.hosts: ["10.44.66.2", "10.116.148.103", "10.170.142.108"]

  73. #

  74. # Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):

  75. #

  76.   discovery.zen.minimum_master_nodes: 2

  77. #

  78. # For more information, see the documentation at:

  79. # <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>

  80. #

  81. # ---------------------------------- Gateway -----------------------------------

  82. #

  83. # Block initial recovery after a full cluster restart until N nodes are started:

  84. #

  85.   gateway.recover_after_nodes: 3

  86.   gateway.recover_after_time: 30m

  87.   gateway.expected_nodes: 3

  88. #

  89. # For more information, see the documentation at:

  90. # <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>

  91. #

  92. # ---------------------------------- Various -----------------------------------

  93. #

  94. # Disable starting multiple nodes on a single system:

  95. #

  96. # node.max_local_storage_nodes: 1

  97. #

  98. # Require explicit names when deleting indices:

  99. #

  100. # action.destructive_requires_name: true

各節點調整node-name的配置信息,保證唯一。

四: 在節點1上面安裝Elasticsearch  插件

1.安裝head插件 監控Elasticsearch的運行狀態以及數據

./plugin -DproxyPort=4832  -DproxyHost=10.116.4.116   install  mobz/elasticsearch-head

紅色部分因為是內網,用了代理訪問外網

2.安裝kopf插件 ---ElasticSearch的管理工具

./plugin -DproxyPort=4832  -DproxyHost=10.116.4.116   install  lmenezes/elasticsearch-kopf

五:啟動

以elsearch用戶啟動三個節點

/mnt/gh/elasticsearch-2.4.4/bin/elasticsearch

六:驗證

1.http://10.44.66.2:9200/

{
  "name" : "gh-cluster-node-01",
  "cluster_name" : "gh-cluster",
  "cluster_uuid" : "iGovr8lcSW62JdEABzLMyg",
  "version" : {
    "number" : "2.4.4",
    "build_hash" : "fcbb46dfd45562a9cf00c604b30849a6dec6b017",
    "build_timestamp" : "2017-01-03T11:33:16Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.2"
  },
  "tagline" : "You Know, for Search"
}


2.head插件  http://10.44.66.2:9200/_plugin/head/

Elasticsearch集群是怎么搭建的

3.kopf插件 http://10.44.66.2:9200/_plugin/kopf/#!/nodes

Elasticsearch集群是怎么搭建的

七:操作命令

1.檢查集群的狀態
curl '10.44.66.2:9200/_cat/health?v'


2.檢查節點的信息
curl '10.44.66.2:9200/_cat/nodes?v'


3.檢查索引信息
curl '10.44.66.2:9200/_cat/indices?v'


4.創建索引
curl -XPUT '10.44.66.2:9200/customer?pretty'


5.往索引中,添加文檔
curl -XPUT '10.44.66.2:9200/customer/external/1?pretty' -d '{"name":"John Doe"}'


6.查看文檔信息
curl -XGET '10.44.66.2:9200/customer/external/1?pretty'


7.查看所有文檔數量
curl -XGET '10.44.66.2:9200/_count?pretty' -d '{"query":{"match_all":{}}}'


8.刪除索引
curl -XDELETE '10.44.66.2:9200/customer?pretty'


9.隨機創建文檔信息
curl -XPOST '10.44.66.2:9200/customer/external?pretty' -d '{"name":"Geng Chong"}'






一個 Elasticsearch 請求和任何 HTTP 請求一樣由若干相同的部件組成:


curl -X<VERB> '<PROTOCOL>://<HOST>:<PORT>/<PATH>?<QUERY_STRING>' -d '<BODY>'


被 < > 標記的部件:


VERB


適當的 HTTP 方法 或 謂詞 : GET`、 `POST`、 `PUT`、 `HEAD 或者 `DELETE`。


PROTOCOL


http 或者 https`(如果你在 Elasticsearch 前面有一個 `https 代理)


HOST


Elasticsearch 集群中任意節點的主機名,或者用 localhost 代表本地機器上的節點。


PORT


運行 Elasticsearch HTTP 服務的端口號,默認是 9200 。


PATH


API 的終端路徑(例如 _count 將返回集群中文檔數量)。Path 可能包含多個組件,例如:_cluster/stats 和 _nodes/stats/jvm 。


QUERY_STRING


任意可選的查詢字符串參數 (例如 ?pretty 將格式化地輸出 JSON 返回值,使其更容易閱讀)


BODY

關于Elasticsearch集群是怎么搭建的問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

百色市| 新河县| 霍山县| 博兴县| 集贤县| 濮阳市| 佛山市| 平原县| 即墨市| 西华县| 同江市| 翁牛特旗| 彰化县| 安西县| 昭平县| 平陆县| 鹿泉市| 洪江市| 汾阳市| 马龙县| 响水县| 喀喇| 繁昌县| 盈江县| 绥滨县| 长顺县| 安国市| 泸定县| 宣武区| 达拉特旗| 茶陵县| 丽江市| 共和县| 南皮县| 哈尔滨市| 福泉市| 错那县| 雅江县| 伊吾县| 陆川县| 浦城县|