我遇到了这个page讨论mcrouter可以使用的不同哈希函数,但是如果你不想使用默认的ch3,则无法找到如何配置哈希函数的示例。在我的情况下,我想在池中的两个节点之间使用具有平衡(50/50)权重的“wch3”。如何手动更改默认配置wch3?
提前致谢。
答案 0 :(得分:0)
以下是可以帮助您的示例:
{
"pools": {
"cold": {
"servers": [
"memc_1:11211",
"memc_2:11211"
]
},
"warm": {
"servers": [
"memc_11:11211",
"memc_12:11211"
]
}
},
"route": {
"type": "OperationSelectorRoute",
"operation_policies": {
"get": {
"type": "WarmUpRoute",
"cold": "PoolRoute|cold",
"warm": "PoolRoute|warm",
"exptime": 20
}
},
"default_policy": {
"type": "AllSyncRoute",
"children": [{
"type": "PoolRoute",
"pool": "cold",
"hash": {
"hash_func": "WeightedCh3",
"weights": [
1,
1
]
}
},
{
"type": "PoolRoute",
"pool": "warm",
"hash": {
"hash_func": "WeightedCh3",
"weights": [
1,
1
]
}
}
]
}
}
}
您可以在[0.0,1.0]范围内调整重量。