|
| 1 | +# MySQL Rest Service schema created. |
| 2 | +CREATE USER mrs_bootstrap_user IDENTIFIED BY 'pass'; |
| 3 | +GRANT SELECT, INSERT, UPDATE on mysql_rest_service_metadata.* to mrs_bootstrap_user; |
| 4 | +GRANT mysql_rest_service_data_provider TO mrs_bootstrap_user WITH ADMIN OPTION; |
| 5 | +GRANT CREATE USER ON *.* TO mrs_bootstrap_user WITH GRANT OPTION; |
| 6 | +GRANT mysql_rest_service_meta_provider TO mrs_bootstrap_user WITH ADMIN OPTION; |
| 7 | +FLUSH PRIVILEGES; |
| 8 | +Warnings: |
| 9 | +Warning 1681 'FLUSH PRIVILEGES' is deprecated and will be removed in a future release. |
| 10 | +# Bootstrapping MySQL Router instance at 'DIRECTORY' |
| 11 | + |
| 12 | +- Storing account in keyring |
| 13 | +- Creating configuration .../mysqlrouter.conf |
| 14 | + |
| 15 | +# MySQL Router configured for the Standalone MySQL Server at 'localhost' |
| 16 | + |
| 17 | +After this, MySQL Router can be started with the generated configuration with: |
| 18 | + |
| 19 | +$ mysqlrouter -c .../mysqlrouter.conf |
| 20 | + |
| 21 | +This Router instance can be reached by connecting to: |
| 22 | + |
| 23 | +## MySQL Classic protocol |
| 24 | + |
| 25 | +- Read/Write Connections: localhost:6446 |
| 26 | +- Read/Only Connections: localhost:6447 |
| 27 | +- Read/Write Split Connections: localhost:6450 |
| 28 | + |
| 29 | +## MySQL X protocol |
| 30 | + |
| 31 | +- Read/Write Connections: localhost:6448 |
| 32 | +- Read/Only Connections: localhost:6449 |
| 33 | + |
| 34 | +[33m# Configuring `MRS` plugin...[39m |
| 35 | + |
| 36 | +- Registering metadata |
| 37 | +- Creating account(s) (only those that are needed, if any) |
| 38 | +- Storing account in keyring |
| 39 | +- Adjusting configuration file .../mysqlrouter.conf |
| 40 | + |
| 41 | +Once the MySQL Router is started, the MySQL REST Service can be reached at |
| 42 | + https://localhost:8443/<service-name> |
| 43 | +# File automatically generated during MySQL Router bootstrap |
| 44 | +[DEFAULT] |
| 45 | +logging_folder=TEMP_DIR_FILE_OR_FOLDER |
| 46 | +runtime_folder=TEMP_DIR_FILE_OR_FOLDER |
| 47 | +data_folder=TEMP_DIR_FILE_OR_FOLDER |
| 48 | +keyring_path=TEMP_DIR_FILE_OR_FOLDER |
| 49 | +master_key_path=TEMP_DIR_FILE_OR_FOLDER |
| 50 | +dynamic_state=TEMP_DIR_FILE_OR_FOLDER |
| 51 | +client_ssl_cert=TEMP_DIR_FILE_OR_FOLDER |
| 52 | +client_ssl_key=TEMP_DIR_FILE_OR_FOLDER |
| 53 | +client_ssl_mode=PREFERRED |
| 54 | +server_ssl_mode=PREFERRED |
| 55 | +server_ssl_verify=DISABLED |
| 56 | +unknown_config_option=error |
| 57 | +max_idle_server_connections=64 |
| 58 | +router_require_enforce=1 |
| 59 | +plugin_folder=ROUTER_PLUGIN_DIRECTORY |
| 60 | + |
| 61 | +[logger] |
| 62 | +level=info |
| 63 | + |
| 64 | +[routing:bootstrap_rw] |
| 65 | +bind_address=0.0.0.0 |
| 66 | +bind_port=6446 |
| 67 | +destinations=ADDR:PORT |
| 68 | +routing_strategy=first-available |
| 69 | +protocol=classic |
| 70 | +router_require_enforce=0 |
| 71 | + |
| 72 | +[routing:bootstrap_ro] |
| 73 | +bind_address=0.0.0.0 |
| 74 | +bind_port=6447 |
| 75 | +destinations=ADDR:PORT |
| 76 | +routing_strategy=round-robin |
| 77 | +protocol=classic |
| 78 | +router_require_enforce=0 |
| 79 | + |
| 80 | +[routing:bootstrap_x_rw] |
| 81 | +bind_address=0.0.0.0 |
| 82 | +bind_port=6448 |
| 83 | +destinations=ADDR:PORT |
| 84 | +routing_strategy=first-available |
| 85 | +protocol=x |
| 86 | +router_require_enforce=0 |
| 87 | + |
| 88 | +[routing:bootstrap_x_ro] |
| 89 | +bind_address=0.0.0.0 |
| 90 | +bind_port=6449 |
| 91 | +destinations=ADDR:PORT |
| 92 | +routing_strategy=round-robin |
| 93 | +protocol=x |
| 94 | +router_require_enforce=0 |
| 95 | + |
| 96 | +[http_server] |
| 97 | +port=8443 |
| 98 | +ssl=1 |
| 99 | +ssl_cert=TEMP_DIR_FILE_OR_FOLDER |
| 100 | +ssl_key=TEMP_DIR_FILE_OR_FOLDER |
| 101 | + |
| 102 | +[http_auth_realm:default_auth_realm] |
| 103 | +backend=default_auth_backend |
| 104 | +method=basic |
| 105 | +name=default_realm |
| 106 | + |
| 107 | +[rest_router] |
| 108 | +require_realm=default_auth_realm |
| 109 | + |
| 110 | +[rest_api] |
| 111 | + |
| 112 | +[http_auth_backend:default_auth_backend] |
| 113 | +backend=file |
| 114 | +filename=TEMP_DIR_FILE_OR_FOLDER |
| 115 | + |
| 116 | +[rest_routing] |
| 117 | +require_realm=default_auth_realm |
| 118 | + |
| 119 | +[mysql_rest_service] |
| 120 | +mysql_read_only_route=bootstrap_ro |
| 121 | +mysql_read_write_route=bootstrap_rw |
| 122 | +mysql_user=mysql_router_mrs1_RANDOM |
| 123 | +mysql_user_data_access= |
| 124 | +router_id=1 |
| 125 | + |
| 126 | +select id, product_name, options from mysql_rest_service_metadata.router; |
| 127 | +id product_name options |
| 128 | +1 MySQL Router {} |
| 129 | +select router_name from mysql_rest_service_metadata.router; |
| 130 | +router_name |
| 131 | +"Name found" |
| 132 | +select attributes from mysql_rest_service_metadata.router; |
| 133 | +attributes |
| 134 | +{"mrs_metadata_accounts": ["mysql_router_mrs1_RANDOM"]} |
| 135 | +DROP USER 'mrs_bootstrap_user'@'%'; |
| 136 | +DROP SCHEMA mysql_rest_service_metadata; |
| 137 | +DROP ROLE mysql_rest_service_admin; |
| 138 | +DROP ROLE mysql_rest_service_schema_admin; |
| 139 | +DROP ROLE mysql_rest_service_meta_provider; |
| 140 | +DROP ROLE mysql_rest_service_data_provider; |
| 141 | +DROP ROLE mysql_rest_service_dev; |
0 commit comments