26#ifndef ROUTER_SRC_BOOTSTRAP_SRC_BOOTSTRAP_CONFIGURATOR_H_
27#define ROUTER_SRC_BOOTSTRAP_SRC_BOOTSTRAP_CONFIGURATOR_H_
51 void init(
int argc,
char **argv);
55 bool raw_mode =
false);
61 std::ostream &out_stream, std::ostream &err_stream,
62 std::vector<std::string> &configs_)
69 const std::string &bootstrap_uri =
"") noexcept
override {
75 OptionNames({
"-u",
"--user"}),
76 "Run the mysqlrouter as the user having the name user_name.",
78 [
this](
const std::string &username) {
81 [
this](
const std::string &) {
97 OptionNames({
"-c",
"--config"}),
98 "Only read configuration from given file.",
100 [
this](
const std::string &
value) {
102 throw std::runtime_error(
103 "Option -c/--config can only be used once; "
104 "use -a/--extra-config instead.");
114 const std::string &
value);
153 const
std::
map<
std::
string,
std::
string> &config_cmdln_options);
162 uint64_t mrs_router_id);
165 const
std::
string &config_path, uint64_t mrs_router_id,
166 const
std::
map<
std::
string,
std::
string> &config_cmdln_options);
172 uint64_t mrs_router_id,
173 const
std::
string &developer_name);
175 uint64_t mrs_router_id,
std::vector< std::string > Strings
Definition: bootstrap_configurator.h:44
std::set< std::string > UniqueStrings
Definition: bootstrap_configurator.h:45
Definition: bootstrap_configurator.h:58
bool is_legacy() const override
Definition: bootstrap_configurator.h:110
std::vector< std::string > & config_files_
Definition: bootstrap_configurator.h:116
void prepare_command_options(CmdArgHandler &arg_handler, const std::string &bootstrap_uri="") noexcept override
Definition: bootstrap_configurator.h:67
bool & is_legacy_
Definition: bootstrap_configurator.h:115
void check_and_add_conf(std::vector< std::string > &configs, const std::string &value)
Definition: bootstrap_configurator.cc:158
MySQLRouterAndMrsConf(bool &is_legacy, KeyringInfo &keyring_info, std::ostream &out_stream, std::ostream &err_stream, std::vector< std::string > &configs_)
Definition: bootstrap_configurator.h:60
Definition: bootstrap_configurator.h:47
bool bootstrap_mrs_
Definition: bootstrap_configurator.h:131
void store_mrs_account_metadata(mysqlrouter::MySQLSession *session, uint64_t mrs_router_id, const std::string &key, const std::string &user, const std::vector< std::string > &hosts)
Definition: bootstrap_configurator.cc:891
void prepare_command_options(const std::string &bootstrap_uri)
Definition: bootstrap_configurator.cc:367
void init(int argc, char **argv)
Definition: bootstrap_configurator.cc:239
void check_mrs_metadata(mysqlrouter::MySQLSession *session) const
Definition: bootstrap_configurator.cc:692
bool is_legacy_
Definition: bootstrap_configurator.h:132
std::string bootstrap_mrs_developer_debug_port_
Definition: bootstrap_configurator.h:130
std::string mrs_secret_
Definition: bootstrap_configurator.h:128
uint64_t register_mrs_router_instance(mysqlrouter::MySQLSession *session)
Definition: bootstrap_configurator.cc:841
CmdArgHandler arg_handler_
Definition: bootstrap_configurator.h:121
void parse_command_options(std::vector< std::string > arguments)
Definition: bootstrap_configurator.cc:346
std::string get_version_line() noexcept
Definition: bootstrap_configurator.cc:455
void store_mrs_developer(mysqlrouter::MySQLSession *session, uint64_t mrs_router_id, const std::string &developer_name)
Definition: bootstrap_configurator.cc:912
KeyringHandler keyring_
Definition: bootstrap_configurator.h:123
void create_mrs_users(mysqlrouter::MySQLSession *session, uint64_t mrs_router_id)
Definition: bootstrap_configurator.cc:591
bool can_configure_mrs(const std::string &config_path) const
Definition: bootstrap_configurator.cc:719
bool showing_info_
Definition: bootstrap_configurator.h:133
BootstrapCredentials mrs_data_account_
Definition: bootstrap_configurator.h:127
mysql_harness::Config config_
Definition: bootstrap_configurator.h:142
std::pair< RoutingConfig, RoutingConfig > get_config_classic_sections() const
Definition: bootstrap_configurator.cc:809
void store_mrs_configuration(const std::string &config_path, uint64_t mrs_router_id, const std::map< std::string, std::string > &config_cmdln_options)
Definition: bootstrap_configurator.cc:750
std::vector< std::string > config_files_
Definition: bootstrap_configurator.h:134
std::string router_program_name_
Definition: bootstrap_configurator.h:119
BootstrapCredentials mrs_metadata_account_
Definition: bootstrap_configurator.h:126
void configure_mrs(mysqlrouter::MySQLSession *session, const std::string &config_path, const std::map< std::string, std::string > &config_cmdln_options)
Definition: bootstrap_configurator.cc:302
BootstrapConfigurator(std::ostream &out_stream, std::ostream &err_stream)
Definition: bootstrap_configurator.cc:181
static void init_main_logger(mysql_harness::LoaderConfig &config, bool raw_mode=false)
Definition: bootstrap_configurator.cc:186
std::string bootstrap_mrs_developer_
Definition: bootstrap_configurator.h:129
void show_help()
Definition: bootstrap_configurator.cc:559
void load_configuration(const std::string &path)
Definition: bootstrap_configurator.cc:586
MySQLRouterAndMrsConf bootstrapper_
Definition: bootstrap_configurator.h:124
void run()
Definition: bootstrap_configurator.cc:275
mysql_harness::Path origin_
Definition: bootstrap_configurator.h:120
void show_usage() noexcept
Definition: bootstrap_configurator.cc:486
std::string get_configured_rest_endpoint() const
Definition: bootstrap_configurator.cc:734
void store_mrs_data_in_keyring()
Definition: bootstrap_configurator.cc:654
Definition: bootstrap_credentials.h:31
Handles command line arguments.
Definition: arg_handler.h:141
void add_option(const CmdOption::OptionNames &names, const std::string &description, const CmdOptionValueReq &value_req, const std::string &metavar, CmdOption::ActionFunc action, CmdOption::AtEndActionFunc at_end_action=[](const std::string &) { }) noexcept
Adds a command line option.
Definition: arg_handler.cc:54
Definition: keyring_handler.h:34
KeyringInfo class encapsulates loading and storing master key using master-key-reader and master-key-...
Definition: keyring_info.h:76
Definition: router_conf.h:52
virtual void prepare_command_options(CmdArgHandler &arg_handler, const std::string &bootstrap_uri="") noexcept
Definition: router_conf.cc:212
std::map< std::string, std::string > bootstrap_options_
key/value map of additional configuration options for bootstrap
Definition: router_conf.h:117
std::string bootstrap_uri_
Value of the argument passed to the -B or –bootstrap command line option for bootstrapping.
Definition: router_conf.h:109
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
Configuration.
Definition: config_parser.h:253
static constexpr unsigned int allow_keys
Flags for construction of configurations.
Definition: config_parser.h:265
Configuration file handler for the loader.
Definition: loader_config.h:46
Class representing a path in a file system.
Definition: filesystem.h:63
Definition: mysql_session.h:157
static SysUserOperations * instance()
Definition: sys_user_operations.cc:49
char * user
Definition: mysqladmin.cc:67
static PasswdValue check_user(const char *user)
Definition: mysqld.cc:3015
static char * path
Definition: mysqldump.cc:150
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
Definition: gcs_xcom_synode.h:64
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2876
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2894
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Defining the main class MySQLRouter.
Definition: bootstrap_configurator.h:136
bool is_metadata_cache
Definition: bootstrap_configurator.h:138
std::string key
Definition: bootstrap_configurator.h:137
std::vector< std::string > OptionNames
Definition: arg_handler.h:58