When you have a cluster using FreeSWITCH (all PBX'es share same database among other things), you will need to know who is the least load server. Regardless what are you using this information for, or how you grab it, you can easily get it doing the following SQL query (remember FreeSWITCH's default database name is freeswitch):
SELECT t.hostname, SUM(t.load_index) AS load_index FROM (select hostname, count(hostname) * 1.5 AS load_index FROM channels GROUP BY hostname UNION SELECT hostname, COUNT(hostname) AS load_index FROM registrations GROUP BY hostname) t ORDER BY load_index DESC
You will get a list of hostnames members of the cluster and a load index.
Remember you will need to use the core-db-dsn and the core-recovery-db-dsn tags in the switch.conf.xml file in order to be able to have the required tables.blog comments powered by Disqus