diff --git a/examples/compose/README.md b/examples/compose/README.md index 991c7d0ad8..fb8d1435ff 100644 --- a/examples/compose/README.md +++ b/examples/compose/README.md @@ -213,12 +213,12 @@ The vreplication container included performs the following actions; 4. Prints out helpful debug information for you. ``` vitess/examples/compose$ docker-compose logs -f vreplication -vreplication_1 | + /vt/bin/vtctlclient --server vtctld:15999 VReplicationExec local-0000000101 'insert into _vt.vreplication (db_name, source, pos, max_tps, max_replication_lag, tablet_types, time_updated, transaction_timestamp, state) values('\''commerce'\'', '\''keyspace:\"ext_commerce\" shard:\"0\" filter: > on_ddl:EXEC_IGNORE '\'', '\'''\'', 9999, 9999, '\''master'\'', 0, 0, '\''Running'\'')' +vreplication_1 | + /vt/bin/vtctlclient --server vtctld:15999 VReplicationExec local-0000000101 'insert into _vt.vreplication (db_name, source, pos, max_tps, max_replication_lag, tablet_types, time_updated, transaction_timestamp, state) values('\''commerce'\'', '\''keyspace:\"ext_commerce\" shard:\"0\" filter: > on_ddl:EXEC_IGNORE '\'', '\'''\'', 9999, 9999, '\''primary'\'', 0, 0, '\''Running'\'')' vreplication_1 | + /vt/bin/vtctlclient --server vtctld:15999 VReplicationExec local-0000000101 'select * from _vt.vreplication' vreplication_1 | +----+----------+--------------------------------+-----+----------+---------+---------------------+------+--------------+--------------+-----------------------+---------+---------+----------+ vreplication_1 | | id | workflow | source | pos | stop_pos | max_tps | max_replication_lag | cell | tablet_types | time_updated | transaction_timestamp | state | message | db_name | vreplication_1 | +----+----------+--------------------------------+-----+----------+---------+---------------------+------+--------------+--------------+-----------------------+---------+---------+----------+ -vreplication_1 | | 1 | | keyspace:"ext_commerce" | | | 9999 | 9999 | | master | 0 | 0 | Running | | commerce | +vreplication_1 | | 1 | | keyspace:"ext_commerce" | | | 9999 | 9999 | | primary | 0 | 0 | Running | | commerce | vreplication_1 | | | | shard:"0" | | | | | | | | | | | | vreplication_1 | | | | filter: > | | | | | | | | | | | | vreplication_1 | | | | on_ddl:EXEC_IGNORE | | | | | | | | | | | | diff --git a/examples/compose/client.go b/examples/compose/client.go index c5ead7602a..9c0c98ba96 100644 --- a/examples/compose/client.go +++ b/examples/compose/client.go @@ -44,7 +44,7 @@ func main() { rand.Seed(time.Now().UnixNano()) // Connect to vtgate. - db, err := vitessdriver.Open(*server, "@master") + db, err := vitessdriver.Open(*server, "@primary") if err != nil { fmt.Printf("client error: %v\n", err) os.Exit(1) @@ -52,7 +52,7 @@ func main() { defer db.Close() // Insert some messages on random pages. - fmt.Println("Inserting into master...") + fmt.Println("Inserting into primary...") for i := 0; i < 3; i++ { tx, err := db.Begin() if err != nil { @@ -73,7 +73,7 @@ func main() { } // Read it back from the primary. - fmt.Println("Reading from master...") + fmt.Println("Reading from primary...") rows, err := db.Query("SELECT page, time_created_ns, message FROM messages") if err != nil { fmt.Printf("query failed: %v\n", err) diff --git a/examples/compose/docker-compose.beginners.yml b/examples/compose/docker-compose.beginners.yml index d01532c2f7..2f6eef1834 100644 --- a/examples/compose/docker-compose.beginners.yml +++ b/examples/compose/docker-compose.beginners.yml @@ -97,7 +97,7 @@ services: -mysql_auth_server_impl none \ -cell $CELL \ -cells_to_watch $CELL \ - -tablet_types_to_wait MASTER,REPLICA \ + -tablet_types_to_wait PRIMARY,REPLICA \ -service_map 'grpc-vtgateservice' \ -enable_system_settings=true \ "] @@ -158,7 +158,7 @@ services: - DB_USER - DB_PASS - DB_CHARSET - - ROLE=master + - ROLE=primary command: ["sh", "-c", "[ $$EXTERNAL_DB -eq 1 ] && /script/vttablet-up.sh 100 || exit 0"] depends_on: - vtctld @@ -190,7 +190,7 @@ services: - DB_USER - DB_PASS - DB_CHARSET - - ROLE=master + - ROLE=primary command: ["sh", "-c", "/script/vttablet-up.sh 101"] depends_on: - vtctld diff --git a/examples/compose/docker-compose.yml b/examples/compose/docker-compose.yml index 2468bc2b2d..f85a5a12bc 100644 --- a/examples/compose/docker-compose.yml +++ b/examples/compose/docker-compose.yml @@ -142,7 +142,7 @@ services: - '/script/run-forever.sh /vt/bin/vtgate -topo_implementation consul -topo_global_server_address consul1:8500 -topo_global_root vitess/global -logtostderr=true -port 8080 -grpc_port 15999 -mysql_server_port 15306 -mysql_auth_server_impl none -cell test -cells_to_watch - test -tablet_types_to_wait MASTER,REPLICA,RDONLY -service_map ''grpc-vtgateservice'' + test -tablet_types_to_wait PRIMARY,REPLICA,RDONLY -service_map ''grpc-vtgateservice'' -normalize_queries=true ' depends_on: - vtctld @@ -186,7 +186,7 @@ services: - CELL=test - KEYSPACE=test_keyspace - SHARD=-80 - - ROLE=master + - ROLE=primary - VTHOST=vttablet101 - EXTERNAL_DB=0 - DB_PORT= @@ -260,7 +260,7 @@ services: - CELL=test - KEYSPACE=test_keyspace - SHARD=80- - - ROLE=master + - ROLE=primary - VTHOST=vttablet201 - EXTERNAL_DB=0 - DB_PORT= @@ -334,7 +334,7 @@ services: - CELL=test - KEYSPACE=lookup_keyspace - SHARD=- - - ROLE=master + - ROLE=primary - VTHOST=vttablet301 - EXTERNAL_DB=0 - DB_PORT= diff --git a/examples/compose/external_db/README.md b/examples/compose/external_db/README.md index 6f148d205f..eacf311c27 100644 --- a/examples/compose/external_db/README.md +++ b/examples/compose/external_db/README.md @@ -108,6 +108,6 @@ a) The Vitess Control Panel at http://:15000 b) The `lvtcl.sh` Helper Script; The steps are same -1. Do an EmergencyReparentShard to make a replica the new master. -2. Ran InitShardPrimary on the new master. -3. If Vitess is wrong about who the MySQL master is, you can update it with TabletExternallyReparented +1. Do an EmergencyReparentShard to make a replica the new primary. +2. Ran InitShardPrimary on the new primary. +3. If Vitess is wrong about who the MySQL primary is, you can update it with TabletExternallyReparented diff --git a/examples/compose/external_db/docker-compose.yml b/examples/compose/external_db/docker-compose.yml index 0316dda58c..4c414324e6 100644 --- a/examples/compose/external_db/docker-compose.yml +++ b/examples/compose/external_db/docker-compose.yml @@ -17,7 +17,7 @@ services: volumes: - vol-db:/var/lib/mysql - ./mysql/:/docker-entrypoint-initdb.d/ - - ./mysql/master_mysql57.cnf:/etc/mysql/conf.d/master_mysql57.cnf:ro + - ./mysql/mysql57.cnf:/etc/mysql/conf.d/mysql57.cnf:ro - ./mysql/log:/var/log/mysql command: - --server-id=1 diff --git a/examples/compose/external_db/mysql/master_mysql56.cnf b/examples/compose/external_db/mysql/mysql56.cnf similarity index 100% rename from examples/compose/external_db/mysql/master_mysql56.cnf rename to examples/compose/external_db/mysql/mysql56.cnf diff --git a/examples/compose/external_db/mysql/master_mysql57.cnf b/examples/compose/external_db/mysql/mysql57.cnf similarity index 100% rename from examples/compose/external_db/mysql/master_mysql57.cnf rename to examples/compose/external_db/mysql/mysql57.cnf diff --git a/examples/compose/externaldb_vreplication.sh b/examples/compose/externaldb_vreplication.sh index 65e24cf005..1138909aa1 100755 --- a/examples/compose/externaldb_vreplication.sh +++ b/examples/compose/externaldb_vreplication.sh @@ -18,28 +18,28 @@ set -ex VTCTLD_SERVER=${VTCTLD_SERVER:-'vtctld:15999'} -# Wait until source and destination masters are available -until (/vt/bin/vtctlclient --server $VTCTLD_SERVER ListAllTablets | grep "ext_" | grep "master" ); do - echo 'waiting for external master..'; +# Wait until source and destination primaries are available +until (/vt/bin/vtctlclient --server $VTCTLD_SERVER ListAllTablets | grep "ext_" | grep "primary" ); do + echo 'waiting for external primary..'; sleep 1; done -until (/vt/bin/vtctlclient --server $VTCTLD_SERVER ListAllTablets | grep -v "ext_" | grep "master" ); do - echo 'waiting for managed master..'; +until (/vt/bin/vtctlclient --server $VTCTLD_SERVER ListAllTablets | grep -v "ext_" | grep "primary" ); do + echo 'waiting for managed primary..'; sleep 1; done # Get source and destination tablet and shard information TABLET_INFO=$(/vt/bin/vtctlclient --server $VTCTLD_SERVER ListAllTablets) -source_alias=$(echo "$TABLET_INFO "| grep "ext_" | grep "master" | awk '{ print $1 }') -dest_alias=$(echo "$TABLET_INFO "| grep -v "ext_" | grep "master" | awk '{ print $1 }') -source_keyspace=$(echo "$TABLET_INFO "| grep "ext_" | grep "master" | awk '{ print $2 }') -dest_keyspace=$(echo "$TABLET_INFO "| grep -v "ext_" | grep "master" | awk '{ print $2 }') -source_shard=$(echo "$TABLET_INFO "| grep "ext_" | grep "master" | awk '{ print $3 }') -dest_shard=$(echo "$TABLET_INFO "| grep -v "ext_" | grep "master" | awk '{ print $3 }') -source_tablet=$(echo "$TABLET_INFO "| grep "ext_" | grep "master" | awk '{ print $2 "/" $3}') -dest_tablet=$(echo "$TABLET_INFO "| grep -v "ext_" | grep "master" | awk '{ print $2 "/" $3}') +source_alias=$(echo "$TABLET_INFO "| grep "ext_" | grep "primary" | awk '{ print $1 }') +dest_alias=$(echo "$TABLET_INFO "| grep -v "ext_" | grep "primary" | awk '{ print $1 }') +source_keyspace=$(echo "$TABLET_INFO "| grep "ext_" | grep "primary" | awk '{ print $2 }') +dest_keyspace=$(echo "$TABLET_INFO "| grep -v "ext_" | grep "primary" | awk '{ print $2 }') +source_shard=$(echo "$TABLET_INFO "| grep "ext_" | grep "primary" | awk '{ print $3 }') +dest_shard=$(echo "$TABLET_INFO "| grep -v "ext_" | grep "primary" | awk '{ print $3 }') +source_tablet=$(echo "$TABLET_INFO "| grep "ext_" | grep "primary" | awk '{ print $2 "/" $3}') +dest_tablet=$(echo "$TABLET_INFO "| grep -v "ext_" | grep "primary" | awk '{ print $2 "/" $3}') # Disable foreign_key checks on destination @@ -68,7 +68,7 @@ done /vt/bin/vtctlclient --server $VTCTLD_SERVER GetSchema $dest_alias # Start vreplication -/vt/bin/vtctlclient --server $VTCTLD_SERVER VReplicationExec $dest_alias 'insert into _vt.vreplication (db_name, source, pos, max_tps, max_replication_lag, tablet_types, time_updated, transaction_timestamp, state) values('"'"''"$dest_keyspace"''"'"', '"'"'keyspace:\"'"$source_keyspace"'\" shard:\"'"$source_shard"'\" filter: > on_ddl:EXEC_IGNORE '"'"', '"'"''"'"', 9999, 9999, '"'"'master'"'"', 0, 0, '"'"'Running'"'"')' +/vt/bin/vtctlclient --server $VTCTLD_SERVER VReplicationExec $dest_alias 'insert into _vt.vreplication (db_name, source, pos, max_tps, max_replication_lag, tablet_types, time_updated, transaction_timestamp, state) values('"'"''"$dest_keyspace"''"'"', '"'"'keyspace:\"'"$source_keyspace"'\" shard:\"'"$source_shard"'\" filter: > on_ddl:EXEC_IGNORE '"'"', '"'"''"'"', 9999, 9999, '"'"'primary'"'"', 0, 0, '"'"'Running'"'"')' # Check vreplication status /vt/bin/vtctlclient --server $VTCTLD_SERVER VReplicationExec $dest_alias 'select * from _vt.vreplication' diff --git a/examples/compose/fix_replication.sh b/examples/compose/fix_replication.sh index 74f6ceb4d1..b1ac687231 100755 --- a/examples/compose/fix_replication.sh +++ b/examples/compose/fix_replication.sh @@ -15,7 +15,7 @@ # limitations under the License. # This is a helper script to sync replicas for mysql. -# It handles the special case where the master has purged bin logs that the replica requires. +# It handles the special case where the primary has purged bin logs that the replica requires. # To use it place a mysql dump of the database on the same directory as this script. # The name of the dump must be $KEYSPACE.sql. The script can also download the mysqldump for you. # Replication is fixed by restoring the mysqldump and resetting the slave. @@ -56,7 +56,7 @@ get_slave_status # Check if SLAVE_IO is running if [[ $SLAVE_IO_RUNNING = "No" && $LAST_ERRNO = 1236 ]]; then - echo "Master has purged bin logs that slave requires. Sync will require restore from mysqldump" + echo "Primary has purged bin logs that replica requires. Sync will require restore from mysqldump" if [[ -f $KEYSPACE.sql ]] ; then echo "mysqldump file $KEYSPACE.sql exists, attempting to restore.." echo "Resetting slave.." diff --git a/examples/compose/vtcompose/docker-compose.test.yml b/examples/compose/vtcompose/docker-compose.test.yml index 1e55db8e9f..b6cd43e294 100644 --- a/examples/compose/vtcompose/docker-compose.test.yml +++ b/examples/compose/vtcompose/docker-compose.test.yml @@ -105,7 +105,7 @@ services: - '/script/run-forever.sh $$VTROOT/bin/vtgate -topo_implementation consul -topo_global_server_address consul1:8500 -topo_global_root vitess/global -logtostderr=true -port 8080 -grpc_port 15999 -mysql_server_port 15306 -mysql_auth_server_impl none -cell test -cells_to_watch - test -tablet_types_to_wait MASTER,REPLICA,RDONLY -gateway_implementation discoverygateway + test -tablet_types_to_wait PRIMARY,REPLICA,RDONLY -gateway_implementation discoverygateway -service_map ''grpc-vtgateservice'' -pid_file $$VTDATAROOT/tmp/vtgate.pid -normalize_queries=true ' depends_on: - vtctld @@ -131,7 +131,7 @@ services: - CELL=test - KEYSPACE=test_keyspace - SHARD=-80 - - ROLE=master + - ROLE=primary - VTHOST=vttablet101 - EXTERNAL_DB=0 - DB_PORT= @@ -205,7 +205,7 @@ services: - CELL=test - KEYSPACE=test_keyspace - SHARD=80- - - ROLE=master + - ROLE=primary - VTHOST=vttablet201 - EXTERNAL_DB=0 - DB_PORT= @@ -279,7 +279,7 @@ services: - CELL=test - KEYSPACE=unsharded_keyspace - SHARD=- - - ROLE=master + - ROLE=primary - VTHOST=vttablet301 - EXTERNAL_DB=0 - DB_PORT= @@ -315,4 +315,4 @@ services: ports: - 15100:8080 - "15999" -version: "2.1" \ No newline at end of file +version: "2.1" diff --git a/examples/compose/vtcompose/vtcompose.go b/examples/compose/vtcompose/vtcompose.go index b78ba1be4f..df1c26b8b3 100644 --- a/examples/compose/vtcompose/vtcompose.go +++ b/examples/compose/vtcompose/vtcompose.go @@ -421,22 +421,22 @@ func applyKeyspaceDependentPatches( } tabAlias := 0 + tabletsUsed*100 shard := "-" - var masterTablets []string + var primaryTablets []string if tabletsUsed == 0 { - masterTablets = append(masterTablets, "101") + primaryTablets = append(primaryTablets, "101") } else { - masterTablets = append(masterTablets, strconv.Itoa((tabletsUsed+1)*100+1)) + primaryTablets = append(primaryTablets, strconv.Itoa((tabletsUsed+1)*100+1)) } interval := int(math.Floor(256 / float64(keyspaceData.shards))) for i := 1; i < keyspaceData.shards; i++ { - masterTablets = append(masterTablets, strconv.Itoa((i+1)*100+1)) + primaryTablets = append(primaryTablets, strconv.Itoa((i+1)*100+1)) } - schemaLoad := generateSchemaload(masterTablets, "", keyspaceData.keyspace, externalDbInfo, opts) + schemaLoad := generateSchemaload(primaryTablets, "", keyspaceData.keyspace, externalDbInfo, opts) dockerComposeFile = applyInMemoryPatch(dockerComposeFile, schemaLoad) - // Append Master and Replica Tablets + // Append Primary and Replica Tablets if keyspaceData.shards < 2 { tabAlias = tabAlias + 100 dockerComposeFile = applyTabletPatches(dockerComposeFile, tabAlias, shard, keyspaceData, externalDbInfoMap, opts) @@ -457,7 +457,7 @@ func applyKeyspaceDependentPatches( } } - tabletsUsed += len(masterTablets) + tabletsUsed += len(primaryTablets) return dockerComposeFile } @@ -511,7 +511,7 @@ func applyShardPatches( if val, ok := externalDbInfoMap[keyspaceData.keyspace]; ok { dbInfo = val } - dockerComposeFile = applyInMemoryPatch(dockerComposeFile, generateExternalmaster(tabAlias, shard, keyspaceData, dbInfo, opts)) + dockerComposeFile = applyInMemoryPatch(dockerComposeFile, generateExternalPrimary(tabAlias, shard, keyspaceData, dbInfo, opts)) return dockerComposeFile } @@ -529,7 +529,7 @@ func generateDefaultShard(tabAlias int, shard string, keyspaceData keyspaceInfo, return fmt.Sprintf(` - op: add - path: /services/init_shard_master%[2]d + path: /services/init_shard_primary%[2]d value: image: vitess/lite:${VITESS_TAG:-latest} command: ["sh", "-c", "/vt/bin/vtctlclient %[5]s InitShardPrimary -force %[4]s/%[3]s %[6]s-%[2]d "] @@ -537,7 +537,7 @@ func generateDefaultShard(tabAlias int, shard string, keyspaceData keyspaceInfo, `, dependsOn, aliases[0], shard, keyspaceData.keyspace, opts.topologyFlags, opts.cell) } -func generateExternalmaster( +func generateExternalPrimary( tabAlias int, shard string, keyspaceData keyspaceInfo, @@ -550,7 +550,7 @@ func generateExternalmaster( aliases = append(aliases, tabAlias+2+i) // replica aliases, e.g. 202, 203, ... } - externalmasterTab := tabAlias + externalPrimaryTab := tabAlias externalDb := "0" if dbInfo.dbName != "" { @@ -577,7 +577,7 @@ func generateExternalmaster( - CELL=%[5]s - SHARD=%[6]s - KEYSPACE=%[7]s - - ROLE=master + - ROLE=primary - VTHOST=vttablet%[1]d - EXTERNAL_DB=%[8]s - DB_PORT=%[9]s @@ -593,7 +593,7 @@ func generateExternalmaster( interval: 30s timeout: 10s retries: 15 -`, externalmasterTab, opts.topologyFlags, opts.webPort, opts.gRpcPort, opts.cell, shard, keyspaceData.keyspace, externalDb, dbInfo.dbPort, dbInfo.dbHost, dbInfo.dbUser, dbInfo.dbPass, dbInfo.dbCharset) +`, externalPrimaryTab, opts.topologyFlags, opts.webPort, opts.gRpcPort, opts.cell, shard, keyspaceData.keyspace, externalDb, dbInfo.dbPort, dbInfo.dbHost, dbInfo.dbUser, dbInfo.dbPass, dbInfo.dbCharset) } func applyTabletPatches( @@ -608,7 +608,7 @@ func applyTabletPatches( if val, ok := externalDbInfoMap[keyspaceData.keyspace]; ok { dbInfo = val } - dockerComposeFile = applyInMemoryPatch(dockerComposeFile, generateDefaultTablet(tabAlias+1, shard, "master", keyspaceData.keyspace, dbInfo, opts)) + dockerComposeFile = applyInMemoryPatch(dockerComposeFile, generateDefaultTablet(tabAlias+1, shard, "primary", keyspaceData.keyspace, dbInfo, opts)) for i := 0; i < keyspaceData.replicaTablets; i++ { dockerComposeFile = applyInMemoryPatch(dockerComposeFile, generateDefaultTablet(tabAlias+2+i, shard, "replica", keyspaceData.keyspace, dbInfo, opts)) } @@ -710,7 +710,7 @@ func generateVtgate(opts vtOptions) string { -mysql_auth_server_impl none \ -cell %[5]s \ -cells_to_watch %[5]s \ - -tablet_types_to_wait MASTER,REPLICA,RDONLY \ + -tablet_types_to_wait PRIMARY,REPLICA,RDONLY \ -service_map 'grpc-vtgateservice' \ -normalize_queries=true \ "] diff --git a/examples/compose/vttablet-up.sh b/examples/compose/vttablet-up.sh index 178620cf7e..1becc52f50 100755 --- a/examples/compose/vttablet-up.sh +++ b/examples/compose/vttablet-up.sh @@ -49,10 +49,10 @@ if (( $uid % 100 % 3 == 0 )) ; then tablet_type='rdonly' fi -# Consider every tablet with %d00 as external master +# Consider every tablet with %d00 as external primary if [ $external = 1 ] && (( $uid % 100 == 0 )) ; then tablet_type='replica' - tablet_role='externalmaster' + tablet_role='externalprimary' keyspace="ext_$keyspace" fi @@ -94,8 +94,8 @@ echo "Removing $VTDATAROOT/$tablet_dir/{mysql.sock,mysql.sock.lock}..." rm -rf $VTDATAROOT/$tablet_dir/{mysql.sock,mysql.sock.lock} # Create mysql instances -# Do not create mysql instance for master if connecting to external mysql database -if [[ $tablet_role != "externalmaster" ]]; then +# Do not create mysql instance for primary if connecting to external mysql database +if [[ $tablet_role != "externalprimary" ]]; then echo "Initing mysql for tablet: $uid role: $role external: $external.. " $VTROOT/bin/mysqlctld \ --init_db_sql_file=$init_db_sql_file \ @@ -111,8 +111,8 @@ sleep $sleeptime $VTROOT/bin/vtctlclient -server vtctld:$GRPC_PORT AddCellInfo -root vitess/$CELL -server_address consul1:8500 $CELL || true #Populate external db conditional args -if [ $tablet_role = "externalmaster" ]; then - echo "Setting external db args for master: $DB_NAME" +if [ $tablet_role = "externalprimary" ]; then + echo "Setting external db args for primary: $DB_NAME" external_db_args="-db_host $DB_HOST \ -db_port $DB_PORT \ -init_db_name_override $DB_NAME \ @@ -133,7 +133,7 @@ if [ $tablet_role = "externalmaster" ]; then -enable_replication_reporter=false \ -enforce_strict_trans_tables=false \ -track_schema_versions=true \ - -vreplication_tablet_type=master \ + -vreplication_tablet_type=primary \ -watch_replication_stream=true" else external_db_args="-init_db_name_override $DB_NAME \