将已有配置文件加载到集群配置中
要将现有的cache.xml或gemfire.properties配置文件加载到新群集,请在启动Locator时使用--load-cluster-configuration-from-dir
参数。
您可以使用此技术将单个服务器的配置迁移到集群配置服务中。 要将已有的cache.xml文件或集群配置加载到集群中,请执行以下步骤:
- 确保Locator当前不在运行。
- 在Locator的工作目录中,如果目录不存在,则创建一个
cluster_config/cluster
目录。 - 将所需的配置文件(cache.xml或gemfire.properties,或者一起)复制到
cluster_config / cluster
目录。 按照如下样例, 重命名配置文件:
- 重命名
cache.xml
为cluster.xml
- 重命名
gemfire.properties
为cluster.properties
- 重命名
在
gfsh
中启动Locator,如下所示:gfsh>start locator --name=<locator_name> --enable-cluster-configuration=true --load-cluster-configuration-from-dir=true
成功启动后,Locator应报告"Cluster configuration service is up and running."。 任何加入这个集群并且把
--use-cluster-configuration
设置为true的服务器将会使用这些配置文件的配置内容。
注意:
如果对cluster.xml或cluster.properties(或group_name.xml或group_name.properties)文件进行任何手动修改,则必须停止Locator,然后使用--load-cluster-configuration-from-dir
参数重启Locator。 在没有Locator重启的情况下,集群配置服务不会使用直接文件修改内容。