MXS-2424 Store information about dynamic Clustrix nodes

Information about the detected Clustrix nodes is now stored to
a Clustrix monitor specific sqlite-database. This will be used
for bootstrapping the Clustrix monitor, in case a statically
defined bootstrap server is unavailable.
This commit is contained in:
Johan Wikman
2019-04-05 13:48:27 +03:00
parent de3f4fe5a8
commit 875146f53c
2 changed files with 162 additions and 3 deletions

View File

@ -14,6 +14,7 @@
#include "clustrixmon.hh"
#include <map>
#include <sqlite3.h>
#include <maxscale/monitor.hh>
#include <maxbase/http.hh>
#include "clustrixmembership.hh"
@ -74,7 +75,9 @@ protected:
void server_removed(SERVER* pServer) override;
private:
ClustrixMonitor(const std::string& name, const std::string& module);
ClustrixMonitor(const std::string& name,
const std::string& module,
sqlite3* pDb);
void pre_loop() override;
void post_loop() override;
@ -127,6 +130,9 @@ private:
return mxb::WorkerLoad::get_time_ms();
}
void persist_node(const ClustrixNode& node);
void unpersist_node(const ClustrixNode& node);
private:
Config m_config;
std::map<int, ClustrixNode> m_nodes;
@ -136,4 +142,5 @@ private:
long m_last_cluster_check { 0 };
SERVER* m_pHub_server { nullptr };
MYSQL* m_pHub_con { nullptr };
sqlite3* m_pDb { nullptr };
};