nomycnf: remove leftover legacy params

* Remove legacy parameters from examples.
* Add comments.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
This commit is contained in:
Sugu Sougoumarane 2018-07-15 20:51:21 -07:00
Родитель 418e36bad0
Коммит 7df31168a8
8 изменённых файлов: 60 добавлений и 101 удалений

Просмотреть файл

@ -20,9 +20,9 @@ The following adjustments need to be made to VTTablet command line parameters:
* Do not use `-mycnf_socket_file`. There is no local MySQL unix socket file.
* Specify the host and port of the MySQL daemon for the `-db-config-XXX-host`
and `-db-config-XXX-port` command line parameters. Do not specify
`-db-config-XXX-unixsocket` parameters.
* Specify the host and port of the MySQL daemon for the `-db\_host`
and `-db\_port` command line parameters. Do not specify
`-db\_socket` parameters.
* Disable restores / backups, by not passing any backup command line
parameters. Specifically, `-restore_from_backup` and

Просмотреть файл

@ -256,36 +256,40 @@ the binlogs in `/mnt/bin-logs`:
VTTablet requires multiple user credentials to perform its tasks. Since it's required to run on the same machine as MySQL, its most beneficial to use the more efficient unix socket connections.
**connection** parameters
* **db\_socket**: The unix socket to connect on. If this is specifed, host and port will not be used.
* **db\_host**: The host name for the tcp connection.
* **db\_port**: The tcp port to be used with the db\_host.
* **db\_charset**: Character set. Only utf8 or latin1 based character sets are supported.
* **db\_flags**: Flag values as defined by MySQL.
* **db\ssl\_ca, db\_ssl\_ca\_path, db\_ssl\_cert, db\_ssl\_key**: SSL flags.
**app** credentials are for serving app queries:
* **db-config-app-unixsocket**: MySQL socket name to connect to.
* **db-config-app-uname**: App username.
* **db-config-app-pass**: Password for the app username. If you need a more secure way of managing and supplying passwords, VTTablet does allow you to plug into a "password server" that can securely supply and refresh usernames and passwords. Please contact the Vitess team for help if youd like to write such a custom plugin.
* **db-config-app-charset**: The only supported character set is utf8. Vitess still works with latin1, but its getting deprecated.
* **db\_app\_user**: App username.
* **db\_app\_password**: Password for the app username. If you need a more secure way of managing and supplying passwords, VTTablet does allow you to plug into a "password server" that can securely supply and refresh usernames and passwords. Please contact the Vitess team for help if youd like to write such a custom plugin.
**appdebug** credentials are for the appdebug user:
* **db\_appdebug\_user**
* **db\_appdebug\_password**
**dba** credentials will be used for housekeeping work like loading the schema or killing runaway queries:
* **db-config-dba-unixsocket**
* **db-config-dba-uname**
* **db-config-dba-pass**
* **db-config-dba-charset**
* **db\_dba\_user**
* **db\_dba\_password**
**repl** credentials are for managing replication. Since repl connections can be used across machines, you can optionally turn on encryption:
**repl** credentials are for managing replication.
* **db-config-repl-uname**
* **db-config-repl-pass**
* **db-config-repl-charset**
* **db-config-repl-flags**: If you want to enable SSL, this must be set to 2048.
* **db-config-repl-ssl-ca**
* **db-config-repl-ssl-cert**
* **db-config-repl-ssl-key**
* **db\_repl\_user**
* **db\_repl\_password**
**filtered** credentials are for performing resharding:
* **db-config-filtered-unixsocket**
* **db-config-filtered-uname**
* **db-config-filtered-pass**
* **db-config-filtered-charset**
* **db\_filtered\_user**
* **db\_filtered\_password**
### Monitoring

Просмотреть файл

@ -14,22 +14,6 @@ if [ "$uid" = "1" ]; then
tablet_role='master'
fi
dbconfig_dba_flags="\
-db-config-dba-uname root \
-db-config-dba-charset utf8"
dbconfig_flags="$dbconfig_dba_flags \
-db-config-app-uname root \
-db-config-app-charset utf8 \
-db-config-appdebug-uname root \
-db-config-appdebug-charset utf8 \
-db-config-allprivs-uname root \
-db-config-allprivs-charset utf8 \
-db-config-repl-uname root \
-db-config-repl-charset utf8 \
-db-config-filtered-uname root \
-db-config-filtered-charset utf8"
init_db_sql_file="$VTROOT/init_db.sql"
echo "GRANT ALL ON *.* TO 'root'@'%';" > $init_db_sql_file
@ -52,7 +36,6 @@ fi
$VTROOT/bin/mysqlctl \
-log_dir $VTDATAROOT/tmp \
-tablet_uid $uid \
$dbconfig_dba_flags \
-mysql_port 3306 \
$action &
@ -78,5 +61,4 @@ exec $VTROOT/bin/vttablet \
-grpc_port $GRPC_PORT \
-service_map 'grpc-queryservice,grpc-tabletmanager,grpc-updatestream' \
-pid_file $VTDATAROOT/$tablet_dir/vttablet.pid \
-vtctld_addr http://vtctld:$WEB_PORT/ \
$dbconfig_flags
-vtctld_addr http://vtctld:$WEB_PORT/

Просмотреть файл

@ -56,18 +56,6 @@ spec:
-init_shard {{shard}}
-init_tablet_type {{tablet_type}}
-mysqlctl_socket $VTDATAROOT/mysqlctl.sock
-db-config-app-uname vt_app
-db-config-app-dbname vt_{{keyspace}}
-db-config-app-charset utf8
-db-config-dba-uname vt_dba
-db-config-dba-dbname vt_{{keyspace}}
-db-config-dba-charset utf8
-db-config-repl-uname vt_repl
-db-config-repl-dbname vt_{{keyspace}}
-db-config-repl-charset utf8
-db-config-filtered-uname vt_filtered
-db-config-filtered-dbname vt_{{keyspace}}
-db-config-filtered-charset utf8
-queryserver-config-transaction-cap 300
-queryserver-config-schema-reload-time 1
-queryserver-config-pool-size 100
@ -98,8 +86,6 @@ spec:
-alsologtostderr
-tablet_uid {{uid}}
-socket_file $VTDATAROOT/mysqlctl.sock
-db-config-dba-uname vt_dba
-db-config-dba-charset utf8
-init_db_sql_file $VTROOT/config/init_db.sql" vitess
env:
- name: EXTRA_MY_CNF

Просмотреть файл

@ -64,18 +64,6 @@ spec:
-init_tablet_type {{tablet_type}}
-health_check_interval 5s
-mysqlctl_socket $VTDATAROOT/mysqlctl.sock
-db-config-app-uname vt_app
-db-config-app-dbname vt_{{keyspace}}
-db-config-app-charset utf8
-db-config-dba-uname vt_dba
-db-config-dba-dbname vt_{{keyspace}}
-db-config-dba-charset utf8
-db-config-repl-uname vt_repl
-db-config-repl-dbname vt_{{keyspace}}
-db-config-repl-charset utf8
-db-config-filtered-uname vt_filtered
-db-config-filtered-dbname vt_{{keyspace}}
-db-config-filtered-charset utf8
-enable_semi_sync
-enable_replication_reporter
-orc_api_url http://orchestrator/api
@ -107,8 +95,6 @@ spec:
-alsologtostderr
-tablet_uid {{uid}}
-socket_file $VTDATAROOT/mysqlctl.sock
-db-config-dba-uname vt_dba
-db-config-dba-charset utf8
-init_db_sql_file $VTROOT/config/init_db.sql" vitess
env:
- name: EXTRA_MY_CNF

Просмотреть файл

@ -74,7 +74,6 @@ for uid_index in $uids; do
$VTROOT/bin/mysqlctl \
-log_dir $VTDATAROOT/tmp \
-tablet_uid $uid \
$dbconfig_dba_flags \
-mysql_port $mysql_port \
$action &
done

Просмотреть файл

@ -14,8 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package dbconfigs is reusable by vt tools to load
// the db configs file.
// Package dbconfigs provides the registration for command line options
// to collect db connection parameters. Once registered and collected,
// it provides variables and functions to build connection parameters
// for connecting to the database.
package dbconfigs
import (
@ -42,14 +44,22 @@ var (
}
)
// DBConfigs is all we need for a smart tablet server:
// - App access with db name for serving app queries
// - AllPrivs access for administrative actions (like schema changes)
// that should be done without SUPER privilege
// - Dba access for any dba-type operation (db creation, replication, ...)
// - Filtered access for filtered replication
// - Replication access to change master
// - SidecarDBName for storing operational metadata
// DBConfigs stores all the data needed to build various connection
// parameters for the db. It stores credentials for app, appdebug,
// allprivs, dba, filtered and repl users.
// It contains other connection parameters like socket, charset, etc.
// It also stores the default db name, which it can combine with the
// rest of the data to build db-sepcific connection parameters.
// It also supplies the SidecarDBName. This is currently hardcoded
// to "_vt", but will soon become customizable.
// The life-cycle of this package is as follows:
// App must call RegisterFlags to request the types of connections
// it wants support for. This must be done before involing flags.Parse.
// After flag parsing, app invokes the Init function, which will return
// a DBConfigs object.
// The app must store the DBConfigs object internally, and use it to
// build connection parameters as needed.
// The DBName is initially empty and may later be set or changed by the app.
type DBConfigs struct {
app mysql.ConnParams
appDebug mysql.ConnParams
@ -113,11 +123,11 @@ func RegisterFlags(flags DBConfigFlag) {
}
func registerBaseFlags() {
flag.StringVar(&baseConfig.Host, "db_host", "", "connection host")
flag.IntVar(&baseConfig.Port, "db_port", 0, "connection port")
flag.StringVar(&baseConfig.UnixSocket, "db_socket", "", "connection unix socket")
flag.StringVar(&baseConfig.Charset, "db_charset", "utf8", "connection charset")
flag.Uint64Var(&baseConfig.Flags, "db_flags", 0, "connection flags")
flag.StringVar(&baseConfig.UnixSocket, "db_socket", "", "The unix socket to connect on. If this is specifed, host and port will not be used.")
flag.StringVar(&baseConfig.Host, "db_host", "", "The host name for the tcp connection.")
flag.IntVar(&baseConfig.Port, "db_port", 0, "tcp port")
flag.StringVar(&baseConfig.Charset, "db_charset", "utf8", "Character set. Only utf8 or latin1 based character sets are supported.")
flag.Uint64Var(&baseConfig.Flags, "db_flags", 0, "Flag values as defined by MySQL.")
flag.StringVar(&baseConfig.SslCa, "db_ssl_ca", "", "connection ssl ca")
flag.StringVar(&baseConfig.SslCaPath, "db_ssl_ca_path", "", "connection ssl ca path")
flag.StringVar(&baseConfig.SslCert, "db_ssl_cert", "", "connection ssl certificate")
@ -241,7 +251,13 @@ func (dbcfgs *DBConfigs) Copy() *DBConfigs {
return result
}
// Init will initialize app, allprivs, dba, filtered and repl configs.
// Init will initialize all the necessary connection parameters.
// Precedence is as follows: if baseConfig command line options are
// set, they supersede all other settings.
// If baseConfig is not set, the next priority is with per-user connection
// parameters. This is only for legacy support.
// If no per-user parameters are supplied, then the defaultSocketFile
// is used to initialize the per-user conn params.
func Init(defaultSocketFile string) (*DBConfigs, error) {
// This is to support legacy behavior: use supplied socket value
// if conn parameters are not specified.

Просмотреть файл

@ -402,18 +402,6 @@ spec:
-init_tablet_type {{ $tablet.type | quote }}
-health_check_interval "5s"
-mysqlctl_socket "/vtdataroot/mysqlctl.sock"
-db-config-app-uname "vt_app"
-db-config-app-dbname "vt_{{$keyspace.name}}"
-db-config-app-charset "utf8"
-db-config-dba-uname "vt_dba"
-db-config-dba-dbname "vt_{{$keyspace.name}}"
-db-config-dba-charset "utf8"
-db-config-repl-uname "vt_repl"
-db-config-repl-dbname "vt_{{$keyspace.name}}"
-db-config-repl-charset "utf8"
-db-config-filtered-uname "vt_filtered"
-db-config-filtered-dbname "vt_{{$keyspace.name}}"
-db-config-filtered-charset "utf8"
-enable_replication_reporter
{{ if $defaultVttablet.enableSemisync }}
-enable_semi_sync
@ -485,8 +473,6 @@ spec:
-tablet_dir "tabletdata"
-tablet_uid "{{$uid}}"
-socket_file "/vtdataroot/mysqlctl.sock"
-db-config-dba-uname "vt_dba"
-db-config-dba-charset "utf8"
-init_db_sql_file "/vt/config/init_db.sql"
END_OF_COMMAND