集群配置文件及故障排除
当您在Geode中使用集群配置服务时,您可以检查Locator的cluster_config
目录中生成的配置文件。 gfsh
按照集群级别和单个组级别保存配置文件。
运行集群配置服务的Locator上,有以下目录和配置文件:
集群级配置
对于适用于集群所有成员的配置,locator会在cluster_config
目录(或者在启动Locator时候使用--cluster-config-dir = value
参数指定的集群配置目录中)创建一个cluster
子目录。 所有服务器在使用gfsh
启动时都会收到这个配置。 这个目录包含:
cluster.xml
-- 一份包含所有成员相同配置的Geodecache.xml
文件cluster.properties
-- 一份包含所有成员相同属性的Geodegemfire.properties
文件- 用于部署到所有成员的Jar文件
组级别配置
When you specify the --group
parameter in a gfsh
command, (for example, start server
or create region
) the locator writes the configurations for each group in a subdirectory with the same name as the group. When you start a server that specifies one or more group names, the server receives both the cluster-level configurations and the configurations from all groups specified. This subdirectory contains:
当在gfsh
命令(例如start server
或create region
)中指定--group
参数时,Locator将每个组的配置写入与组名相同的子目录中。 当您启动服务器指定一个或多个组名称时,服务器将同时收到集群级配置和所有指定组的配置。 这个子目录包含:
<group-name>.xml
-- Geodecache.xml
文件,其中包含该组所有成员相同配置<group-name>.properties
-- Geodegemfire.properties
文件,其中包含该组所有成员相同属性- 用于部署到组的所有成员的Jar文件
您可以导出包含集群配置所有内容的zip文件。 zip文件包含locator的cluster_config
(或其他指定的)子目录中的所有文件。 您可以将此配置导入到新的群集。 请参阅 导出和导入集群配置.
单独配置文件和集群配置文件
Geode首先应用集群范围的配置文件,然后应用组级配置。 如果成员有自己定义的配置文件(cache.xml和gemfire.properties文件),那么最后应用这些配置。 只要有可能,请使用集群配置服务的成员组级别配置文件对集群中的各个成员进行非群集范围的配置。
故障排除Tips
当你使用
gfsh
开始一个Locator时,你应该看到以下消息:Cluster configuration service is up and running.
如果您没有看到此消息,则可能是集群配置服务存在问题。 使用
status cluster-configuration-service
命令来检查集群配置的状态。- 如果该命令返回RUNNING,则表明集群配置正常运行。
- 如果该命令返回WAITING,则运行
status locator
命令。 此命令的输出返回WAITING状态的原因。
- 如果服务器启动失败,出现以下异常:
ClusterConfigurationNotAvailableException
, 集群配置服务可能不处于RUNNING状态。由于服务器从Locator请求集群配置, 而集群配置服务不可用,则会导致start server
命令失败。 - 您可以通过检查服务器的日志文件, 来确定服务器从Locator接收到的配置内容。 请参阅 Logging.
- 如果
start server
命令指定一个与现有集群配置冲突的cache.xml文件,则服务器启动可能会失败。 如果由于无法保存集群配置而导致
gfsh
命令失败,将显示以下消息:Failed to persist the configuration changes due to this command, Revert the command to maintain consistency. Please use "status cluster-config-service" to determine whether Cluster configuration service is RUNNING."
有一些类型的配置不能使用
gfsh
来完成。 请参阅 gfsh 限制.