Documentation |
Documentation -> Tutorials -> How To Configure a "Full Sharing" User Location ClusterThis page has been visited 10039 times. How To Configure a "Full Sharing" User Location Clusterby Liviu Chircu Table of Content (hide) 1. DescriptionTip: For a broader view on the "full sharing" topology, see this blog post.
2. Active/passive "full sharing" setup2.1 ConfigurationFor the smallest possible setup (a 2-node active/passive with a virtual IP in front), you will need:
listen = sip:10.0.0.150 # virtual IP (same on both nodes) listen = bin:10.0.0.177 loadmodule "usrloc.so" modparam("usrloc", "use_domain", 1) modparam("usrloc", "working_mode_preset", "full-sharing-cluster") modparam("usrloc", "location_cluster", 1) loadmodule "clusterer.so" modparam("clusterer", "current_id", 1) # node number #1 modparam("clusterer", "seed_fallback_interval", 5) modparam("clusterer", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") loadmodule "proto_bin.so" 2.2 ProvisioningINSERT INTO clusterer(id, cluster_id, node_id, url, state, no_ping_retries, priority, sip_addr, flags, description) VALUES \ (NULL, 1, 1, 'bin:10.0.0.177', 1, 3, 50, NULL, 'seed', NULL), \ (NULL, 1, 2, 'bin:10.0.0.178', 1, 3, 50, NULL, NULL, NULL);
Native "full sharing" clusterer table
2.3 NAT pingingSome setups require periodic SIP OPTIONS pings originated by the registrar towards some of the contacts in order to keep the NAT bindings alive. Here is an example configuration: loadmodule "nathelper.so" modparam("nathelper", "natping_interval", 30) modparam("nathelper", "sipping_from", "sip:pinger@localhost") modparam("nathelper", "sipping_bflag", "SIPPING_ENABLE") modparam("nathelper", "remove_on_timeout_bflag", "SIPPING_RTO") modparam("nathelper", "max_pings_lost", 5) We then enable these branch flags for some or all contacts before calling save(): ... setbflag(SIPPING_ENABLE); setbflag(SIPPING_RTO); if (!save("location")) sl_reply_error(); ...
opensipsctl fifo nh_enable_ping 1 # run this on the machine that takes over the VIP (new active) opensipsctl fifo nh_enable_ping 0 # run this on the machine that gives up the VIP (new passive) 3. NoSQL "full sharing" cluster with a SIP front-endThis is the ultra-scalable version of the OpenSIPS user location, allowing you to support subscriber pool sizes exceeding the order of millions. By letting an external, specialized database cluster manage all the registration data, we are able to decouple the SIP signaling and data storage systems. This, in turn, allows each system to be scaled without wasting resources or affecting the other one. 3.1 ConfigurationFor the smallest possible setup, you will need:
listen = sip:10.0.0.177 listen = bin:10.0.0.177 loadmodule "usrloc.so" modparam("usrloc", "use_domain", 1) modparam("usrloc", "working_mode_preset", "full-sharing-cachedb-cluster") modparam("usrloc", "location_cluster", 1) # with Cassandra, make sure to create the keyspace and table beforehand: # CREATE KEYSPACE IF NOT EXISTS opensips WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true; # USE opensips; # CREATE TABLE opensips.userlocation ( # aor text, # aorhash int, # contacts map<text, frozen<map<text, text>>>, # PRIMARY KEY (aor)); loadmodule "cachedb_cassandra.so" modparam("usrloc", "cachedb_url", "cassandra://10.0.0.180:9042/opensips.userlocation") # with MongoDB, we don't need to create any database or collection... loadmodule "cachedb_mongodb.so" modparam("usrloc", "cachedb_url", "mongodb://10.0.0.180:27017/opensipsDB.userlocation") loadmodule "clusterer.so" modparam("clusterer", "current_id", 1) # node number #1 modparam("clusterer", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") loadmodule "proto_bin.so" ... route { ... # store the registration into the NoSQL DB if (!save("location", "p1v")) { send_reply("500", "Server Internal Error"); exit; } ... } 3.2 ProvisioningINSERT INTO clusterer(id, cluster_id, node_id, url, state, no_ping_retries, priority, sip_addr, flags, description) VALUES \ (NULL, 1, 1, 'bin:10.0.0.177', 1, 3, 50, NULL, 'seed', NULL), \ (NULL, 1, 2, 'bin:10.0.0.178', 1, 3, 50, NULL, NULL, NULL);
NoSQL "full sharing" clusterer table
3.3 Shared NAT pingingloadmodule "nathelper.so" modparam("nathelper", "natping_interval", 30) modparam("nathelper", "sipping_from", "sip:pinger@localhost") modparam("nathelper", "sipping_bflag", "SIPPING_ENABLE") modparam("nathelper", "remove_on_timeout_bflag", "SIPPING_RTO") modparam("nathelper", "max_pings_lost", 5) # partition pings across cluster nodes modparam("usrloc", "shared_pinging", 1) We then enable these branch flags for some or all contacts before calling save(): ... setbflag(SIPPING_ENABLE); setbflag(SIPPING_RTO); # store the registration, along with the Path header, into the NoSQL DB if (!save("location", "p1v")) { sl_reply_error(); exit; } ... |