17 Commits

Author SHA1 Message Date
Johan Wikman
92b27500c7 MXS-2276 Fix things due to MXS_MONITOR -> Monitor change 2019-01-25 10:30:27 +02:00
Johan Wikman
42b3402a71 MXS-2276 Use dynamic servers also for cluster check
Once the monitor has been able to connect to a clustrix node
and obtain the clustrix nodes, it'll primarily use those nodes
when looking for a Clustrix node to be used as the "hub".
With this change it is sufficient (but perhaps unwise) to provide
a single node boostrap node in the configuration file.

Some other rearrangements and renamings of functions has also been
made.
2019-01-25 10:30:27 +02:00
Johan Wikman
6937bb6663 MXS-2274 Create globally unique name for dynamic servers
Convention needs to be that the runtime object creating other objects
needs to incorporate its own name in the name of any object created.
Together with the '@@' prefix that ensures that the created name will
be reasonably globally unique.
2019-01-24 17:42:29 +02:00
Esa Korhonen
f6cec41dd8 MXS-2271 Monitor config name and instance name are parameters of createInstance()
Also adds/moves some comments from previous entrypoints. Name and module
are now constant fields.
2019-01-24 09:49:53 +02:00
Esa Korhonen
dadb6a1a79 MXS-2271 All monitors inherit from MXS_MONITOR
Most of the API entrypoints are replaced with virtual functions.
2019-01-22 15:59:17 +02:00
Johan Wikman
a7f0bcc4c5 MXS-2219 Close server connection if unusable
If a server cannot be used, close the associated MYSQL connection.
Further, when an existing connection is used, verify that the server
is still part of the quorum.
2019-01-21 15:41:55 +02:00
Johan Wikman
c51895eaad MXS-2219 Replace for_each with regular for loops
In this context the former provides no advantage.
2019-01-21 15:41:55 +02:00
Johan Wikman
01c3da9e0f MXS-2219 Check that monitored server is part of quorum
When the monitor connects to a Clustrix node, it checks that
the node is part of the quorum, before taking it into use.
2019-01-21 15:41:55 +02:00
Johan Wikman
6b556859ce MXS-2219 Use system.membership as primary table
From system.membership we can find out what server exist in the
cluster while system.nodeinfo contains information about those
servers. If a node goes down, it will disappear from system.nodeinfo,
but not from system.membership. Consequently, we must start from
system.membership and then fetch more information from system.nodeinfo.

Incidentally, a query like

    SELECT ms.nid, ni.iface_ip
    FROM system.membership AS ms
        LEFT JOIN system.nodeinfo AS ni ON ms.nid=ni.nodeid;

should provide all information in one go, but it seems that such joins
are not supported on the system tables.
2019-01-21 15:41:55 +02:00
Johan Wikman
f7c840df26 MXS-2219 Update datastructures instead of recreating them
The node infos of the Clustrix servers are now kept around and
and updated based upon changing conditions instead of regularly
being re-created.

Further, the server is now looked up by name only right after
having been created (and that only due to runtime_create_server()
currently being used).

The state of the dynamically created server is now updated directly
as a result of the health-check ping, while the state of the bootstrap
servers is updated during the tick()-call according to the monitor
"protocol".
2019-01-21 15:41:55 +02:00
Johan Wikman
ac61e205d8 MXS-2219 Dynamically create Clustrix servers
MaxScale server objects are now created for all Clustrix nodes.
Currently the name is "Clustrix-Server-N" where N is the number
of the node.

The server is created using runtime_create_server() that has been
modified so that it optionally will not persist the created server.
That is probably just a temporary solution as a monitor should not
need to include .../core/internal-stuff.
2019-01-17 11:11:21 +02:00
Johan Wikman
bd2eb3d5dc MXS-2219 Allow starting Clx monitor with no servers 2019-01-17 11:11:21 +02:00
Johan Wikman
89c059411d MXS-2219 Add health check threshold
Make it configurable how many times a node may fail to respond
on the health check port before it is considered to be down.
2019-01-17 11:11:21 +02:00
Johan Wikman
880842e55d MXS-2219 Perform cluster monitoring as well
Now the monitor
- will frequently ping the health port of each server
- less frequently check from system.membership the actual
  number of available nodes
and act accordingly.

Currently, the updated servers are the ones listed in the conf
file. Subsequently this will be changed so that the servers listed
in the configuration file are only used for bootstrapping the monitor
and server objects are then created dynamically according to what is
found in the cluster.
2019-01-17 11:11:21 +02:00
Johan Wikman
f8545a0b7f MXS-2219 Address review comments 2019-01-07 12:59:57 +02:00
Johan Wikman
4512295e40 MXS-2219 Implement rudimentary Clustrix monitoring
The monitor now pings the health check ports of the Clustrix nodes.
A response translates to RUNNING and a non-response to DOWN.
2019-01-07 12:59:27 +02:00
Johan Wikman
115feab946 MXS-2164 Add skeleton Clustrix monitor 2018-12-18 15:17:09 +02:00