按照如下步骤执行即可成功在本地部署集群:
1. 官网下载es包(该步骤省略)
下载后的包长这样:
2. 正式集群前先看看有没有官方文档可以参考,于是在文档中发现如下资料:
- Set up a new Elasticsearch instance.
- Specify the name of the cluster with the cluster.name\color{#FF3030}cluster.namecluster.name setting in elasticsearch.yml\color{#FF3030}elasticsearch.ymlelasticsearch.yml. For example, to add a node to the logging-prod cluster, add the line cluster.name: “logging-prod” to elasticsearch.yml.
- Start Elasticsearch. The node automatically discovers and joins the specified cluster.
我们来解读一下官方文档:
- 安装一个新的Elasticsearch实例,也就是说将下载后的压缩包复制一份并解压作为第二个ES实例,特别需要注意的是,如果目前你机器里已经有一份ES实例,而且里面有数据,那么如果你直接复制该实例文件夹作为第二个实例,就算改了第二个实例的配置文件,启动后也可能出现集群里只有一个节点,因为两个节点ID会相同。
- 在elasticsearch.yml\color{#FF3030}elasticsearch.ymlelasticsearch.yml配置文件里面配置集群名,它对应的key是cluste