MXS-1635 Allow using specific address when connecting
In some cases you might want to use a specific address/interface when connecting to a server instead of the default one. With the global parameter 'local_address' it can now be specified which address to use.
This commit is contained in:
@ -537,6 +537,17 @@ This will log all statements that cannot be parsed completely. This may be
|
|||||||
useful if you suspect that MariaDB MaxScale routes statements to the wrong
|
useful if you suspect that MariaDB MaxScale routes statements to the wrong
|
||||||
server (e.g. to a slave instead of to a master).
|
server (e.g. to a slave instead of to a master).
|
||||||
|
|
||||||
|
#### `local_address`
|
||||||
|
|
||||||
|
What specific local address/interface to use when connecting to servers.
|
||||||
|
|
||||||
|
This can be used for ensuring that MaxScale uses a particular interface
|
||||||
|
when connecting to servers, in case the computer MaxScale is running on
|
||||||
|
has multiple interfaces.
|
||||||
|
```
|
||||||
|
local_address=192.168.1.254
|
||||||
|
```
|
||||||
|
|
||||||
### Service
|
### Service
|
||||||
|
|
||||||
A service represents the database service that MariaDB MaxScale offers to the
|
A service represents the database service that MariaDB MaxScale offers to the
|
||||||
|
|||||||
63
Documentation/Release-Notes/MaxScale-2.1.14-Release-Notes.md
Normal file
63
Documentation/Release-Notes/MaxScale-2.1.14-Release-Notes.md
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# MariaDB MaxScale 2.1.14 Release Notes
|
||||||
|
|
||||||
|
Release 2.1.14 is a GA release.
|
||||||
|
|
||||||
|
This document describes the changes in release 2.1.14, when compared
|
||||||
|
to release [2.1.13](MaxScale-2.1.13-Release-Notes.md).
|
||||||
|
|
||||||
|
If you are upgrading from release 2.0, please also read the following
|
||||||
|
release notes:
|
||||||
|
|
||||||
|
* [2.1.13](./MaxScale-2.1.13-Release-Notes.md)
|
||||||
|
* [2.1.12](./MaxScale-2.1.12-Release-Notes.md)
|
||||||
|
* [2.1.11](./MaxScale-2.1.11-Release-Notes.md)
|
||||||
|
* [2.1.10](./MaxScale-2.1.10-Release-Notes.md)
|
||||||
|
* [2.1.9](./MaxScale-2.1.9-Release-Notes.md)
|
||||||
|
* [2.1.8](./MaxScale-2.1.8-Release-Notes.md)
|
||||||
|
* [2.1.7](./MaxScale-2.1.7-Release-Notes.md)
|
||||||
|
* [2.1.6](./MaxScale-2.1.6-Release-Notes.md)
|
||||||
|
* [2.1.5](./MaxScale-2.1.5-Release-Notes.md)
|
||||||
|
* [2.1.4](./MaxScale-2.1.4-Release-Notes.md)
|
||||||
|
* [2.1.3](./MaxScale-2.1.3-Release-Notes.md)
|
||||||
|
* [2.1.2](./MaxScale-2.1.2-Release-Notes.md)
|
||||||
|
* [2.1.1](./MaxScale-2.1.1-Release-Notes.md)
|
||||||
|
* [2.1.0](./MaxScale-2.1.0-Release-Notes.md)
|
||||||
|
|
||||||
|
For any problems you encounter, please consider submitting a bug report at
|
||||||
|
[Jira](https://jira.mariadb.org).
|
||||||
|
|
||||||
|
## New Features
|
||||||
|
|
||||||
|
### Local Address
|
||||||
|
|
||||||
|
It is now possible to specify what local address MaxScale should
|
||||||
|
use when connecting to servers. Please refer to the documentation
|
||||||
|
for [details](../Getting-Started/Configuration-Guide.md#local_address).
|
||||||
|
|
||||||
|
## Bug fixes
|
||||||
|
|
||||||
|
[Here is a list of bugs fixed in MaxScale 2.1.14.](https://jira.mariadb.org/issues/?jql=project%20%3D%20MXS%20AND%20issuetype%20%3D%20Bug%20AND%20status%20%3D%20Closed%20AND%20fixVersion%20%3D%202.1.14)
|
||||||
|
|
||||||
|
* [MXS-1627](https://jira.mariadb.org/browse/MXS-1627) MySQLAuth loads users that use authentication plugins
|
||||||
|
* [MXS-1620](https://jira.mariadb.org/browse/MXS-1620) CentOS package symbols are stripped
|
||||||
|
* [MXS-1602](https://jira.mariadb.org/browse/MXS-1602) cannot connect to maxinfo with python client
|
||||||
|
* [MXS-1601](https://jira.mariadb.org/browse/MXS-1601) maxinfo crash at execute query 'flush;'
|
||||||
|
* [MXS-1600](https://jira.mariadb.org/browse/MXS-1600) maxscale it seen to not coop well with lower-case-table-names=1 on cnf
|
||||||
|
* [MXS-1576](https://jira.mariadb.org/browse/MXS-1576) Maxscale crashes when starting if .avro and .avsc files are present
|
||||||
|
* [MXS-1543](https://jira.mariadb.org/browse/MXS-1543) Avrorouter doesn't detect MIXED or STATEMENT format replication
|
||||||
|
* [MXS-1416](https://jira.mariadb.org/browse/MXS-1416) maxscale should not try to do anything when started with --config-check
|
||||||
|
|
||||||
|
## Packaging
|
||||||
|
|
||||||
|
RPM and Debian packages are provided for the Linux distributions supported by
|
||||||
|
MariaDB Enterprise.
|
||||||
|
|
||||||
|
Packages can be downloaded [here](https://mariadb.com/resources/downloads).
|
||||||
|
|
||||||
|
## Source Code
|
||||||
|
|
||||||
|
The source code of MaxScale is tagged at GitHub with a tag, which is identical
|
||||||
|
with the version of MaxScale. For instance, the tag of version X.Y.Z of MaxScale
|
||||||
|
is maxscale-X.Y.Z.
|
||||||
|
|
||||||
|
The source code is available [here](https://github.com/mariadb-corporation/MaxScale).
|
||||||
@ -77,6 +77,7 @@ typedef struct
|
|||||||
char* qc_args; /**< Arguments for the query classifier */
|
char* qc_args; /**< Arguments for the query classifier */
|
||||||
int query_retries; /**< Number of times a interrupted query is retried */
|
int query_retries; /**< Number of times a interrupted query is retried */
|
||||||
time_t query_retry_timeout; /**< Timeout for query retries */
|
time_t query_retry_timeout; /**< Timeout for query retries */
|
||||||
|
char* local_address; /**< Local address to use when connecting */
|
||||||
} MXS_CONFIG;
|
} MXS_CONFIG;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1401,6 +1401,10 @@ handle_global_item(const char *name, const char *value)
|
|||||||
MXS_FREE(v);
|
MXS_FREE(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (strcmp(name, "local_address") == 0)
|
||||||
|
{
|
||||||
|
gateway.local_address = MXS_STRDUP_A(value);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; lognames[i].name; i++)
|
for (i = 0; lognames[i].name; i++)
|
||||||
|
|||||||
@ -41,6 +41,7 @@
|
|||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
|
|
||||||
#include <maxscale/alloc.h>
|
#include <maxscale/alloc.h>
|
||||||
|
#include <maxscale/config.h>
|
||||||
#include <maxscale/dcb.h>
|
#include <maxscale/dcb.h>
|
||||||
#include <maxscale/log_manager.h>
|
#include <maxscale/log_manager.h>
|
||||||
#include <maxscale/limits.h>
|
#include <maxscale/limits.h>
|
||||||
@ -986,15 +987,47 @@ int open_network_socket(enum mxs_socket_type type, struct sockaddr_storage *addr
|
|||||||
memcpy(addr, ai->ai_addr, ai->ai_addrlen);
|
memcpy(addr, ai->ai_addr, ai->ai_addrlen);
|
||||||
set_port(addr, port);
|
set_port(addr, port);
|
||||||
|
|
||||||
|
freeaddrinfo(ai);
|
||||||
|
|
||||||
if ((type == MXS_SOCKET_NETWORK && !configure_network_socket(so)) ||
|
if ((type == MXS_SOCKET_NETWORK && !configure_network_socket(so)) ||
|
||||||
(type == MXS_SOCKET_LISTENER && !configure_listener_socket(so)))
|
(type == MXS_SOCKET_LISTENER && !configure_listener_socket(so)))
|
||||||
{
|
{
|
||||||
close(so);
|
close(so);
|
||||||
so = -1;
|
so = -1;
|
||||||
}
|
}
|
||||||
}
|
else if (type == MXS_SOCKET_NETWORK)
|
||||||
|
{
|
||||||
|
MXS_CONFIG* config = config_get_global_options();
|
||||||
|
|
||||||
|
if (config->local_address)
|
||||||
|
{
|
||||||
|
if ((rc = getaddrinfo(config->local_address, NULL, &hint, &ai)) == 0)
|
||||||
|
{
|
||||||
|
struct sockaddr_storage local_address = {};
|
||||||
|
|
||||||
|
memcpy(&local_address, ai->ai_addr, ai->ai_addrlen);
|
||||||
freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
|
|
||||||
|
if (bind(so, (struct sockaddr*)&local_address, sizeof(local_address)) == 0)
|
||||||
|
{
|
||||||
|
MXS_INFO("Bound connecting socket to \"%s\".", config->local_address);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MXS_ERROR("Could not bind connecting socket to local address \"%s\", "
|
||||||
|
"connecting to server using default local address: %s",
|
||||||
|
config->local_address, mxs_strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MXS_ERROR("Could not get address information for local address \"%s\", "
|
||||||
|
"connecting to server using default local address: %s",
|
||||||
|
config->local_address, mxs_strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user