better only use values comprised between 1 and this value to
avoid overlap.
+ id32 The node keys will be derived from the server's numeric
+ identifier as set from "id" or which defaults to its position
+ in the server list, but the full 32 bits of the ID will be
+ used so that there is no collision. This one is not scaled
+ like "id" is, so it is recommended to either always use it
+ with a hash function (see "hash-key") or with explicitly
+ assigned ID values that are evenly distributed over the 32-bit
+ space.
+
addr The node keys will be derived from the server's address, when
available, or else fall back on "id".
/* srv methods of computing chash keys */
enum srv_hash_key {
- SRV_HASH_KEY_ID = 0, /* derived from server puid */
+ SRV_HASH_KEY_ID = 0, /* derived from server puid, 28 LSB used */
+ SRV_HASH_KEY_ID32, /* derived from server puid, 32 bits used */
SRV_HASH_KEY_ADDR, /* derived from server address */
SRV_HASH_KEY_ADDR_PORT /* derived from server address and port */
};
struct proxy *curproxy, struct server *newsrv, char **err)
{
if (!args[*cur_arg + 1]) {
- memprintf(err, "'%s expects 'id', 'addr', or 'addr-port' value", args[*cur_arg]);
+ memprintf(err, "'%s expects 'id', 'id32', 'addr', or 'addr-port' value", args[*cur_arg]);
return ERR_ALERT | ERR_FATAL;
}
if (strcmp(args[*cur_arg + 1], "id") == 0) {
newsrv->hash_key = SRV_HASH_KEY_ID;
}
+ else if (strcmp(args[*cur_arg + 1], "id32") == 0) {
+ newsrv->hash_key = SRV_HASH_KEY_ID32;
+ }
else if (strcmp(args[*cur_arg + 1], "addr") == 0) {
newsrv->hash_key = SRV_HASH_KEY_ADDR;
}
newsrv->hash_key = SRV_HASH_KEY_ADDR_PORT;
}
else {
- memprintf(err, "'%s' has to be 'id', 'addr', or 'addr-port'", args[*cur_arg]);
+ memprintf(err, "'%s' has to be 'id', 'id32', 'addr', or 'addr-port'", args[*cur_arg]);
return ERR_ALERT | ERR_FATAL;
}