Configuring a Central ZooKeeper Cluster
To use a central Apache ZooKeeper for multiple environments, the ZooKeeper configurations for each ThingWorx High Availability cluster must be namespaced. Otherwise, all components will see each other and potentially join together when not wanted.
ThingWorx Settings
ThingWorx platform settings must be configured with the namespaces for both ThingWorx and Apache Ignite.
You must add or change ZkNamespace in the ClusterModeSettings section. For more information, see Platform Settings for ThingWorx HA.
"ClusteredModeSettings": {
"ZKNamespace" : "mycluster",
}
Update the basePath in the Ignite address-resolver section. The name does not have to match the cluster mode name but it can.
"cache": {
"provider-type": "com.thingworx.cache.ignite.IgniteCacheProvider",
"ignite": {
"address-resolver" : {
"type": "zookeeper",
"basePath" : "mycluster"
}
}
}
Ignite Settings
Set the basePath in the config.xml used to start Ignite. The name must match the name used in the ThingWorx cache address-resolver section.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.zk.TcpDiscoveryZookeeperIpFinder">
<property name="zkConnectionString" value="zookeeper:2181"/>
<property name="basePath" value="mycluster"/>
</bean>
</property>
</bean>
</property>
Connection Server Settings
For Connection Servers, the basePath used for service discovery can be set in the discovery section of the Connection Server configuration. The value prefix must match the value used in the ThingWorx cluster settings section and end with /services. This applies to AlwaysOn, eMessage, and Azure IoT.
discovery {
connectionString = "zookeeper:2181"
basePath = "mycluster/services"
}
For Containers
ThingWorx Settings
Set the environment variables ZOOKEEPER_BASE_PATH and IGNITE_ZK_BASE_PATH:
ZOOKEEPER_BASE_PATH=mycluster
IGNITE_ZK_BASE_PATH=mycluster
Ignite Settings
Set the environment variable ZOOKEEPER_BASE_PATH:
ZOOKEEPER_BASE_PATH=mycluster
Connection Server Settings
Set the environment variable SERVICE_DISCOVERY_BASE_PATH as below. You do not need to specify /services since it is built into the configuration. This applies to AlwaysOn, eMessage, and Azure IoT.
SERVICE_DISCOVERY_BASE_PATH=mycluster
Was this helpful?