{"id":1361,"date":"2019-10-25T13:18:37","date_gmt":"2019-10-25T08:18:37","guid":{"rendered":"http:\/\/alexeyka.zantsev.com\/?p=1361"},"modified":"2021-03-17T16:50:48","modified_gmt":"2021-03-17T11:50:48","slug":"opensips-2-4-usrloc-full-sharing-cluster","status":"publish","type":"post","link":"https:\/\/alexeyka.zantsev.com\/?p=1361","title":{"rendered":"OpenSIPS 2.4 usrloc full-sharing cluster"},"content":{"rendered":"\n<p>UPD: 2019-november-5. An <a rel=\"noreferrer noopener\" aria-label=\"official tutorial (opens in a new tab)\" href=\"https:\/\/www.opensips.org\/Documentation\/Tutorials-Distributed-User-Location-Full-Sharing\" target=\"_blank\">official tutorial<\/a> is available now! And some <a href=\"http:\/\/lists.opensips.org\/pipermail\/users\/2019-November\/041841.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"discussion (opens in a new tab)\">discussion<\/a> on the mail list.<\/p>\n\n\n\n<p>Draft\/some notes&#8230;<\/p>\n\n\n\n<p>2 OpenSIPS nodes without MongoDB<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>clusterer.so module &#8211; one node is configured as seed (in case of using MongoDB for usrloc, both nodes were seed)<ul><li>if a non-seed node restarts, it gets usrloc from seed one via bin interface<\/li><li>if a seed node is restarted, we have to get all usrloc records from non-seed one using &#8216;opensipsctl fifo ul_cluster_sync&#8217; command<\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/alexeyka.zantsev.com\/wp-content\/uploads\/2019\/10\/cluster_fullsharing.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/alexeyka.zantsev.com\/wp-content\/uploads\/2019\/10\/cluster_fullsharing.png\" alt=\"\" class=\"wp-image-1377\" width=\"441\" height=\"59\"\/><\/a><\/figure>\n\n\n\n<p>Key settings:<\/p>\n\n\n\n<p>loadmodule &#8220;usrloc.so&#8221;<br> modparam(&#8220;usrloc&#8221;, &#8220;db_url&#8221;, &#8220;mysql:\/\/opensips:pass@10.145.213.63\/opensips&#8221;)<br> modparam(&#8220;usrloc&#8221;, &#8220;nat_bflag&#8221;, &#8220;NAT&#8221;)<br> modparam(&#8220;usrloc&#8221;, &#8220;working_mode_preset&#8221;, &#8220;full-sharing-cluster&#8221;)<br> modparam(&#8220;usrloc&#8221;, &#8220;location_cluster&#8221;, 1)<br> modparam(&#8220;usrloc&#8221;, &#8220;use_domain&#8221;, 1)<\/p>\n\n\n\n<p>loadmodule &#8220;clusterer.so&#8221;    # requires proto_bin.so<br> modparam(&#8220;clusterer&#8221;, &#8220;current_id&#8221;, 1)<br> modparam(&#8220;clusterer&#8221;, &#8220;db_mode&#8221;, 1)<br> modparam(&#8220;clusterer&#8221;, &#8220;db_url&#8221;, &#8220;mysql:\/\/opensips:pass@10.145.213.63\/opensips&#8221;)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n    # initial INVITE\n    if(is_method(\"INVITE\")) {\n\tt_on_failure(\"1\");\n\t$var(lookup_flags) = \"m\";\n\tif (cluster_check_addr(\"1\", \"$si\")) {\n\t\txlog(\"si: $si . $rm from cluster, doing local lookup only\\n\");\n\t} else {\n\t\txlog(\"si: $si . $rm from outside, doing global lookup\\n\");\n\t\t$var(lookup_flags) = $var(lookup_flags) + \"g\";\n\t}\n\tif (!lookup(\"location\", \"$var(lookup_flags)\")) {\n\t\tt_reply(\"404\", \"Not Found\");\n\t\texit;\n\t}\n\tif (has_body(\"application\/sdp\")) {\n\t    rtpengine_offer(\"RTP\/AVP replace-origin replace-session-connection ICE=remove\");\n\t}\n\n    }\t# initial invite END\n<\/code><\/pre>\n\n\n\n<p>UPD: some useful notes from Liviu Chircu: <a href=\"http:\/\/lists.opensips.org\/pipermail\/users\/2019-October\/041819.html\">http:\/\/lists.opensips.org\/pipermail\/users\/2019-October\/041819.html<\/a><\/p>\n\n\n\n<p>Pay attention: according to his advice, we don&#8217;t need any data in &#8216;sip_addr&#8217; columns when creating a full-sharing usrloc cluster. In case of federated cluster we have to fill them with IP addresses on which OpenSIPS nodes are listening.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UPD: 2019-november-5. An official tutorial is available now! And some discussion on the mail list. Draft\/some notes&#8230; 2 OpenSIPS nodes without MongoDB clusterer.so module &#8211; one node is configured as seed (in case of using MongoDB for usrloc, both nodes were seed) if a non-seed node restarts, it gets usrloc from seed one via bin [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[208],"class_list":["post-1361","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-opensips"],"_links":{"self":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/1361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1361"}],"version-history":[{"count":16,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/1361\/revisions"}],"predecessor-version":[{"id":5049,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/1361\/revisions\/5049"}],"wp:attachment":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}