--- title: EFK加入新的node tags: EFK --- # EFK加入新的node ### ES會自動分配分散在node裡的資料 當我們只有**單一node**在ES裡,沒有任何replica shard,這時候cluster state會變成<font color='yellow'>==YELLOW==</font>,<font color='blue'>這個cluster是可以正常運作的,但是他有資料丟失的風險.</font> ![](https://i.imgur.com/9UHDZoC.png) 在cluster中加入node的目的是為了增加他的 capacity 和 reliability,每個節點預設可以做為 data node也能作為master node的候選人. 當我們增加一些node到cluster中,cluster會自動分配 replica shards,當所以primary和replica shards都是 active的,cluster state會變成<font color='green'>GREEN</font> ![](https://i.imgur.com/qjG10Wt.png) ### 加入新的node實作 1. 建立一個新的 Elasticsearch instance 2. 設定 `cluster.name` in `Elasticsearch.yml` 3. `systemctl restart elasticsearch` 4. 修改`discovery.seed_hosts` in `Elasticsearch.yml` ### FAQ 1. [搭建elsticsearch集群 报错with the same id but is a different node instance解决办法](https://blog.csdn.net/qq_24879495/article/details/77718032) 情境:直接clone其他node 做法:將path.data的路徑刪除, e.g.,`/var/lib/elasticsearch`再重啟