Secondary Cluster
Learn how to connect to a secondary Elasticsearch cluster using CBElasticsearch
box coldbox create module name=SecondaryCluster directory=modules_app dependencies=cbElasticsearchsettings = {
versionTarget = '7.0.0',
hosts = [
//In this example, our secondary is on the same server, different port
{
serverProtocol: "http",
serverName: "elasticsearch-cluster2",
serverPort: 9200
}
],
// keep these credentials, but leave blank
defaultCredentials = {
"username" : "",
"password" : ""
},
defaultIndex = "otherData",
// The default number of shards to use when creating an index
defaultIndexShards = getSystemSetting( "ELASTICSEARCH_SHARDS", 5 ),
// The default number of index replicas to create
defaultIndexReplicas = getSystemSetting( "ELASTICSEARCH_REPLICAS", 0 ),
// Whether to use separate threads for client transactions
multiThreaded = true,
// The maximum amount of time to wait until releasing a connection (in seconds)
maxConnectionIdleTime = 30,
// The maximum number of connections allowed per route ( e.g. search URI endpoint )
maxConnectionsPerRoute = 10,
// The maxium number of connectsion, in total for all Elasticsearch requests
maxConnections = getSystemSetting( "ELASTICSEARCH_MAX_CONNECTIONS", 100 ),
// Read timeout - the read timeout in milliseconds
readTimeout = getSystemSetting( "ELASTICSEARCH_READ_TIMEOUT", 3000 ),
// Connection timeout - timeout attempts to connect to elasticsearch after this timeout
connectionTimeout = getSystemSetting( "ELASTICSEARCH_CONNECT_TIMEOUT", 3000 )
};Last updated
Was this helpful?