Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-5230

Add a way to configure the preference of servers

Details

    • New Feature
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 24.02.2, 24.02.3
    • None
    • galeramon, readconnroute
    • None

    Description

      Add a mechanism which allows the order of the servers to be selected based on a user-configurable parameter. For example, with servers A, B and C used in a service, the mechanism should allow:

      [My-Service]
      type=service
      router=readconnroute
      servers=A,B,C
      preference=C,B,A
      

      For readconnroute, this should select server C if it's valid, then B and finally A if no other server is available. Servers not included in the preference parameter would be considered after the ones defined in it.

      A syntax could be added that could be used to group the servers. This allow finer control over how the servers are used:

      [My-Service]
      type=service
      router=readconnroute
      servers=A,B,C,D,E,F,G
      preference=(C,D),A,(B,G),F
      

      The servers would get selected in this order:

      1. C or D
      2. A
      3. B or G
      4. F

      Original title: Add formal configuration option for allowing duplicate servers in MaxScale

      Original description:

      Currently, the MaxScale server allows the use of duplicate servers only when the debug=allow-duplicate-servers option is set in the configuration. This functionality should be enhanced to enable allowing duplicate servers through a standard, non-debug configuration option.

      Steps to Reproduce:

      1. Set up a MaxScale configuration with multiple servers that may have overlapping host/port combinations.
      2. Attempt to configure MaxScale to allow duplicate servers using the debug option debug=allow-duplicate-servers.
      3. Note that this feature is only accessible through a debug configuration setting.

      Expected Behavior:

      The system should allow the configuration of duplicate servers through a standard configuration option, such as allow_duplicate_servers, rather than relying on a debug option. This should be clearly documented and easily accessible for production use.

      Proposed Solution:

      1. Introduce a new configuration option, allow_duplicate_servers, in the MaxScale configuration file.
      2. Update the server creation logic to check this new option instead of the debug flag.
      3. Ensure that the new option is properly documented in the MaxScale configuration guide.
        Additional Information:

      In version 2.3.12, it was possible to add the same server multiple times without needing a debug option. This feature should be reintroduced in a more formal and user-friendly manner.

      Rationale:

      Allowing duplicate servers via a standard configuration option improves usability and flexibility, making it easier for users to manage their server configurations without needing to enable debug settings. This change aligns with best practices for production environments and enhances the overall robustness of the MaxScale server management

      Attachments

        Activity

          johan.wikman Johan Wikman added a comment -

          Why do you need to be able to add the same server multiple times? That's almost always a mistake, which is why we prevented it.
          We made it possible to enable that using a debug option, since that functionality is sometimes useful during development.

          johan.wikman Johan Wikman added a comment - Why do you need to be able to add the same server multiple times? That's almost always a mistake, which is why we prevented it. We made it possible to enable that using a debug option, since that functionality is sometimes useful during development.
          Carverok Abel Alam added a comment - - edited

          The ability to add the same server multiple times with different configurations is a critical feature for our deployment. We utilize this capability to assign different priorities and behaviors to the same server depending on the specific port or service being accessed. This configuration ensures that our applications, which connect through different ports, can prioritize certain servers when they are available, thereby reducing the risk of deadlocks and ensuring optimal performance.

          For example, an application connecting to port 4301 is configured to prioritize server mysql-c1-1-a-m1 when it is available, while an application connecting to port 4302 prioritizes server mysql-c1-2-b-m2. Similarly, a connection through port 4303 would prioritize server mysql-c1-exd-1-c-m3. This targeted priority setup is crucial for our operational needs, as it allows us to control traffic flow and server load based on the specific requirements of each application and service.

          # by Puppet
           
          # MaxScale documentation:
          # https://mariadb.com/kb/en/mariadb-enterprise/mariadb-maxscale-22/
           
          # Global parameters
          #
          # Complete list of configuration options:
          # https://mariadb.com/kb/en/mariadb-enterprise/mariadb-maxscale-22-mariadb-maxscale-configuration-usage-scenarios/
           
          [maxscale]
          threads=auto
           
          # Server m1
          [mysql-c1-1-a-m1]
          type=server
          address=mysql-c1-1-a.eu-central-1
          port=3306
          protocol=MariaDBBackend
          priority=1
           
          [mysql-c1-2-b-m1]
          type=server
          address=mysql-c1-2-b.eu-central-1
          port=3306
          protocol=MariaDBBackend
          priority=2
           
          [mysql-c1-exd-1-c-m1]
          type=server
          address=mysql-c1-exd-1-c.eu-central-1
          port=3306
          protocol=MariaDBBackend
          priority=3
           
          # Monitor m1
           
          [galera-monitor-m1]
          type=monitor
          module=galeramon
          disable_master_failback=1
          available_when_donor=true
          servers=mysql-c1-1-a-m1,mysql-c1-2-b-m1,mysql-c1-exd-1-c-m1,
          use_priority=true
          monitor_interval=2000
          backend_connect_timeout=5
          backend_write_timeout=5
          backend_read_timeout=5
          user=maxscale
          passwd=password
           
          # Service m1
           
          [galera-service-m1]
          type=service
          router=readconnroute
          router_options=master
          servers=mysql-c1-1-a-m1,mysql-c1-2-b-m1,mysql-c1-exd-1-c-m1,
          log_auth_warnings=true
          user=maxscale
          passwd=password
           
          # Listener m1
           
          [galera-listener-m1]
          type=listener
          service=galera-service-m1
          protocol=MariaDBClient
          port=4301
           
          # Server m2
          [mysql-c1-1-a-m2]
          type=server
          address=mysql-c1-1-a.eu-central-1
          port=3306
          protocol=MariaDBBackend
          priority=2
           
          [mysql-c1-2-b-m2]
          type=server
          address=mysql-c1-2-b.eu-central-1
          port=3306
          protocol=MariaDBBackend
          priority=1
           
          [mysql-c1-exd-1-c-m2]
          type=server
          address=mysql-c1-exd-1-c.eu-central-1
          port=3306
          protocol=MariaDBBackend
          priority=3
           
          # Monitor m2
           
          [galera-monitor-m2]
          type=monitor
          module=galeramon
          disable_master_failback=1
          available_when_donor=true
          servers=mysql-c1-1-a-m2,mysql-c1-2-b-m2,mysql-c1-exd-1-c-m2,
          use_priority=true
          monitor_interval=2000
          backend_connect_timeout=5
          backend_write_timeout=5
          backend_read_timeout=5
          user=maxscale
          passwd=password
           
          # Service m2
           
          [galera-service-m2]
          type=service
          router=readconnroute
          router_options=master
          servers=mysql-c1-1-a-m2,mysql-c1-2-b-m2,mysql-c1-exd-1-c-m2,
          log_auth_warnings=true
          user=maxscale
          passwd=password
           
          # Listener m2
           
          [galera-listener-m2]
          type=listener
          service=galera-service-m2
          protocol=MariaDBClient
          port=4302
           
          # Server m3
          [mysql-c1-1-a-m3]
          type=server
          address=mysql-c1-1-a.eu-central-1
          port=3306
          protocol=MariaDBBackend
          priority=2
           
          [mysql-c1-2-b-m3]
          type=server
          address=mysql-c1-2-b.eu-central-1
          port=3306
          protocol=MariaDBBackend
          priority=3
           
          [mysql-c1-exd-1-c-m3]
          type=server
          address=mysql-c1-exd-1-c.eu-central-1
          port=3306
          protocol=MariaDBBackend
          priority=1
           
          # Monitor m3
           
          [galera-monitor-m3]
          type=monitor
          module=galeramon
          disable_master_failback=1
          available_when_donor=true
          servers=mysql-c1-1-a-m3,mysql-c1-2-b-m3,mysql-c1-exd-1-c-m3,
          use_priority=true
          monitor_interval=2000
          backend_connect_timeout=5
          backend_write_timeout=5
          backend_read_timeout=5
          user=maxscale
          passwd=password
           
          # Service m3
           
          [galera-service-m3]
          type=service
          router=readconnroute
          router_options=master
          servers=mysql-c1-1-a-m3,mysql-c1-2-b-m3,mysql-c1-exd-1-c-m3,
          log_auth_warnings=true
          user=maxscale
          passwd=password
           
          # Listener m3
           
          [galera-listener-m3]
          type=listener
          service=galera-service-m3
          protocol=MariaDBClient
          port=4303
           
          #default options
           
          [MaxAdmin-Service]
          type=service
          router=cli
           
          [MaxAdmin-Listener]
          type=listener
          service=MaxAdmin-Service
          protocol=maxscaled
          socket=default
          

          Carverok Abel Alam added a comment - - edited The ability to add the same server multiple times with different configurations is a critical feature for our deployment. We utilize this capability to assign different priorities and behaviors to the same server depending on the specific port or service being accessed. This configuration ensures that our applications, which connect through different ports, can prioritize certain servers when they are available, thereby reducing the risk of deadlocks and ensuring optimal performance. For example, an application connecting to port 4301 is configured to prioritize server mysql-c1-1-a-m1 when it is available, while an application connecting to port 4302 prioritizes server mysql-c1-2-b-m2. Similarly, a connection through port 4303 would prioritize server mysql-c1-exd-1-c-m3. This targeted priority setup is crucial for our operational needs, as it allows us to control traffic flow and server load based on the specific requirements of each application and service. # by Puppet   # MaxScale documentation: # https: //mariadb.com/kb/en/mariadb-enterprise/mariadb-maxscale-22/   # Global parameters # # Complete list of configuration options: # https: //mariadb.com/kb/en/mariadb-enterprise/mariadb-maxscale-22-mariadb-maxscale-configuration-usage-scenarios/   [maxscale] threads=auto   # Server m1 [mysql-c1- 1 -a-m1] type=server address=mysql-c1- 1 -a.eu-central- 1 port= 3306 protocol=MariaDBBackend priority= 1   [mysql-c1- 2 -b-m1] type=server address=mysql-c1- 2 -b.eu-central- 1 port= 3306 protocol=MariaDBBackend priority= 2   [mysql-c1-exd- 1 -c-m1] type=server address=mysql-c1-exd- 1 -c.eu-central- 1 port= 3306 protocol=MariaDBBackend priority= 3   # Monitor m1   [galera-monitor-m1] type=monitor module=galeramon disable_master_failback= 1 available_when_donor= true servers=mysql-c1- 1 -a-m1,mysql-c1- 2 -b-m1,mysql-c1-exd- 1 -c-m1, use_priority= true monitor_interval= 2000 backend_connect_timeout= 5 backend_write_timeout= 5 backend_read_timeout= 5 user=maxscale passwd=password   # Service m1   [galera-service-m1] type=service router=readconnroute router_options=master servers=mysql-c1- 1 -a-m1,mysql-c1- 2 -b-m1,mysql-c1-exd- 1 -c-m1, log_auth_warnings= true user=maxscale passwd=password   # Listener m1   [galera-listener-m1] type=listener service=galera-service-m1 protocol=MariaDBClient port= 4301   # Server m2 [mysql-c1- 1 -a-m2] type=server address=mysql-c1- 1 -a.eu-central- 1 port= 3306 protocol=MariaDBBackend priority= 2   [mysql-c1- 2 -b-m2] type=server address=mysql-c1- 2 -b.eu-central- 1 port= 3306 protocol=MariaDBBackend priority= 1   [mysql-c1-exd- 1 -c-m2] type=server address=mysql-c1-exd- 1 -c.eu-central- 1 port= 3306 protocol=MariaDBBackend priority= 3   # Monitor m2   [galera-monitor-m2] type=monitor module=galeramon disable_master_failback= 1 available_when_donor= true servers=mysql-c1- 1 -a-m2,mysql-c1- 2 -b-m2,mysql-c1-exd- 1 -c-m2, use_priority= true monitor_interval= 2000 backend_connect_timeout= 5 backend_write_timeout= 5 backend_read_timeout= 5 user=maxscale passwd=password   # Service m2   [galera-service-m2] type=service router=readconnroute router_options=master servers=mysql-c1- 1 -a-m2,mysql-c1- 2 -b-m2,mysql-c1-exd- 1 -c-m2, log_auth_warnings= true user=maxscale passwd=password   # Listener m2   [galera-listener-m2] type=listener service=galera-service-m2 protocol=MariaDBClient port= 4302   # Server m3 [mysql-c1- 1 -a-m3] type=server address=mysql-c1- 1 -a.eu-central- 1 port= 3306 protocol=MariaDBBackend priority= 2   [mysql-c1- 2 -b-m3] type=server address=mysql-c1- 2 -b.eu-central- 1 port= 3306 protocol=MariaDBBackend priority= 3   [mysql-c1-exd- 1 -c-m3] type=server address=mysql-c1-exd- 1 -c.eu-central- 1 port= 3306 protocol=MariaDBBackend priority= 1   # Monitor m3   [galera-monitor-m3] type=monitor module=galeramon disable_master_failback= 1 available_when_donor= true servers=mysql-c1- 1 -a-m3,mysql-c1- 2 -b-m3,mysql-c1-exd- 1 -c-m3, use_priority= true monitor_interval= 2000 backend_connect_timeout= 5 backend_write_timeout= 5 backend_read_timeout= 5 user=maxscale passwd=password   # Service m3   [galera-service-m3] type=service router=readconnroute router_options=master servers=mysql-c1- 1 -a-m3,mysql-c1- 2 -b-m3,mysql-c1-exd- 1 -c-m3, log_auth_warnings= true user=maxscale passwd=password   # Listener m3   [galera-listener-m3] type=listener service=galera-service-m3 protocol=MariaDBClient port= 4303   # default options   [MaxAdmin-Service] type=service router=cli   [MaxAdmin-Listener] type=listener service=MaxAdmin-Service protocol=maxscaled socket= default
          markus makela markus makela added a comment -

          It seems like you need a feature that allows you to control server selection preference based on the listener more than you need to have duplicate servers. I'd imagine that implementing a feature that allows you to do this without duplicating the server sections would be a better solution.

          markus makela markus makela added a comment - It seems like you need a feature that allows you to control server selection preference based on the listener more than you need to have duplicate servers. I'd imagine that implementing a feature that allows you to do this without duplicating the server sections would be a better solution.
          Carverok Abel Alam added a comment -

          We agree that a feature allowing us to control server selection preferences directly within each listener would indeed be an elegant solution. For example, being able to define the priority order for the servers within the listener itself—such as prioritizing mysql-c1-1-a, mysql-c1-2-b, mysql-c1-exd-1-c for port 4301, and mysql-c1-2-b, mysql-c1-1-a, mysql-c1-exd-1-c for port 4302—would streamline the configuration and reduce redundancy.

          However, we would still be satisfied with the current approach of using duplicate server entries if it could be supported without the need for enabling the debug mode. The flexibility to configure server priorities either through a single server definition or through the existing method with duplicates is essential for our deployment needs. Therefore, either solution would work for us, as long as it's available in a non-debug configuration.

          Carverok Abel Alam added a comment - We agree that a feature allowing us to control server selection preferences directly within each listener would indeed be an elegant solution. For example, being able to define the priority order for the servers within the listener itself—such as prioritizing mysql-c1-1-a, mysql-c1-2-b, mysql-c1-exd-1-c for port 4301, and mysql-c1-2-b, mysql-c1-1-a, mysql-c1-exd-1-c for port 4302—would streamline the configuration and reduce redundancy. However, we would still be satisfied with the current approach of using duplicate server entries if it could be supported without the need for enabling the debug mode. The flexibility to configure server priorities either through a single server definition or through the existing method with duplicates is essential for our deployment needs. Therefore, either solution would work for us, as long as it's available in a non-debug configuration.
          johan.wikman Johan Wikman added a comment -

          Carverok Your use-case makes sense, but like Markus I'm not sure duplicate server entries is the best way for realizing it.
          Note that the only thing debug=allow-duplicate-servers does, is to allow duplicate server entries in the configuration. It does not e.g. turn on any kind of debugging mode, but MaxScale functions otherwise exactly like without that flag.

          johan.wikman Johan Wikman added a comment - Carverok Your use-case makes sense, but like Markus I'm not sure duplicate server entries is the best way for realizing it. Note that the only thing debug=allow-duplicate-servers does, is to allow duplicate server entries in the configuration. It does not e.g. turn on any kind of debugging mode, but MaxScale functions otherwise exactly like without that flag.
          markus makela markus makela added a comment - - edited

          One way to solve the problem of selectively routing to servers would be to implement lazy_connect in readconnroute and then use the namedserverfilter to inject a routing hint than then guides the connection selection in readconnroute. This would have the benefit of falling back to the other servers if the target of the routing hint goes away.

          markus makela markus makela added a comment - - edited One way to solve the problem of selectively routing to servers would be to implement lazy_connect in readconnroute and then use the namedserverfilter to inject a routing hint than then guides the connection selection in readconnroute. This would have the benefit of falling back to the other servers if the target of the routing hint goes away.

          People

            maxmether Max Mether
            Carverok Abel Alam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.