MXS-2556 Check if TCP/IP socket is used and warn about it
If the server (a real one or a service exposed as a server) is on the same machine as MaxScale, then for performance reasons a Unix domain socket and not a TCP/IP socket should be used.
This commit is contained in:
parent
acdc3b2396
commit
df5377f135
@ -86,11 +86,29 @@ bool SmartRouter::Config::post_configure(const MXS_CONFIG_PARAMETER& params)
|
||||
bool rv = true;
|
||||
|
||||
auto servers = params.get_server_list(CN_SERVERS);
|
||||
// TODO: Check that the servers are local ones.
|
||||
|
||||
auto it = std::find(servers.begin(), servers.end(), m_master.get());
|
||||
bool master_found = false;
|
||||
|
||||
if (it == servers.end())
|
||||
for (SERVER* pServer : servers)
|
||||
{
|
||||
if (pServer == m_master.get())
|
||||
{
|
||||
master_found = true;
|
||||
}
|
||||
|
||||
if (pServer->address[0] != '/')
|
||||
{
|
||||
if (strcmp(pServer->address, "127.0.0.1") == 0 || strcmp(pServer->address, "localhost"))
|
||||
{
|
||||
MXS_WARNING("The server %s, used by the smartrouter, is currently accessed "
|
||||
"using a TCP/IP socket (%s:%d). For better performance, a Unix "
|
||||
"domain socket should be used. See the 'socket' argument.",
|
||||
pServer->name(), pServer->address, pServer->port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rv && !master_found)
|
||||
{
|
||||
rv = false;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user