mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-07 20:09:12 +00:00
In this patch, we add the possibility to declare on a table definition ("table" in peer section, or "stick-table" in proxy section) that we want the remote/peer updates on that table to be pushed on a local haproxy table in addition to the source table. Consider this example: |peers mypeers | peer local 127.0.0.1:3334 | peer clust 127.0.0.1:3333 | table t1.local type string size 10m store server_id,server_key expire 30s | table t1.clust type string size 10m store server_id,server_key write-to mypeers/t1.local expire 30s With this setup, we consider haproxy uses t1.local as cache/local table for read and write operations, and that t1.clust is a remote table containing datas processed from t1.local and similar tables from other haproxy peers in a cluster setup. The t1.clust table will be used to refresh the local/cache one via the "write-to" statement. What will happen, is that every time haproxy will see entry updates for the t1.clust table: it will overwrite t1.local table with fresh data and will update the entry expiration timer. If t1.local entry doesn't exist yet (key doesn't exist), it will automatically create it. Note that only types that cannot be used for arithmetic ops will be handled, and this to prevent processed values from the remote table from interfering with computations based on values from the local table. (ie: prevent cumulative counters from growing indefinitely). "write-to" will only push supported types if they both exist in the source and the target table. Be careful with server_id and server_key storage because they are often declared implicitly when referencing a table in sticking rules but it is required to declare them explicitly for them to be pushed between a remote and a local table through "write-to" option. Also note that the "write-to" target table should have the same type as the source one, and that the key length should be strictly equal, otherwise haproxy will raise an error due to the tables being incompatibles. A table that is already being written to cannot be used as a source table for a "write-to" target. Thanks to this patch, it will now be possible to use sticking rules in peer cluster context by using a local table as a local cache which will be automatically refreshed by one or multiple remote table(s). This commit depends on: - "MINOR: stktable: stktable_init() sets err_msg on error" - "MINOR: stktable: check if a type should be used as-is" |
||
---|---|---|
.. | ||
design-thoughts | ||
internals | ||
lua-api | ||
51Degrees-device-detection.txt | ||
acl.fig | ||
architecture.txt | ||
coding-style.txt | ||
configuration.txt | ||
cookie-options.txt | ||
DeviceAtlas-device-detection.txt | ||
gpl.txt | ||
haproxy.1 | ||
intro.txt | ||
lgpl.txt | ||
linux-syn-cookies.txt | ||
lua.txt | ||
management.txt | ||
netscaler-client-ip-insertion-protocol.txt | ||
network-namespaces.txt | ||
peers-v2.0.txt | ||
peers.txt | ||
proxy-protocol.txt | ||
queuing.fig | ||
regression-testing.txt | ||
seamless_reload.txt | ||
SOCKS4.protocol.txt | ||
SPOE.txt | ||
WURFL-device-detection.txt |