зеркало из https://github.com/github/vitess-gh.git
Now the local examples use 'zk2' topology.
Instead of the soon-to-be-deprecated 'zookeeper' one.
This commit is contained in:
Родитель
b9bc473b69
Коммит
98e7aafeb5
|
@ -102,7 +102,7 @@ sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
|
|||
possible to use another lock server, but plugins currently exist only
|
||||
for ZooKeeper and etcd.
|
||||
- ZooKeeper 3.3.5 is included by default.
|
||||
- [Install etcd v2.0+](https://github.com/coreos/etcd/releases).
|
||||
- [Install etcd v3.0+](https://github.com/coreos/etcd/releases).
|
||||
If you use etcd, remember to include the `etcd` command
|
||||
on your path.
|
||||
|
||||
|
@ -399,9 +399,10 @@ lock service. ZooKeeper is included in the Vitess distribution.
|
|||
Vitess process how to connect to ZooKeeper. Then, each process can
|
||||
find all of the other Vitess processes by coordinating via ZooKeeper.
|
||||
|
||||
Each of our scripts automatically sets the `ZK_CLIENT_CONFIG` environment
|
||||
variable to point to the `zk-client-conf.json` file, which contains the
|
||||
ZooKeeper server addresses for each cell.
|
||||
Each of our scripts automatically uses the `TOPOLOGY_FLAGS` environment
|
||||
variable to point to the global ZooKeeper instance. The global instance in
|
||||
turn is configured to point to the local instance. In our sample scripts,
|
||||
they are both hosted in the same ZooKeeper service.
|
||||
|
||||
1. **Start vtctld**
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
hostname=`hostname -f`
|
||||
vtctld_web_port=15000
|
||||
|
||||
# Each ZooKeeper server needs a list of all servers in the quorum.
|
||||
# Since we're running them all locally, we need to give them unique ports.
|
||||
|
@ -27,9 +28,9 @@ if [ -z "$VT_MYSQL_ROOT" ]; then
|
|||
export VT_MYSQL_ROOT=$(dirname `dirname $mysql_path`)
|
||||
fi
|
||||
|
||||
# We expect to find zk-client-conf.json in the same folder as this script.
|
||||
env_script_root=`dirname "${BASH_SOURCE}"`
|
||||
export ZK_CLIENT_CONFIG=$env_script_root/zk-client-conf.json
|
||||
# Set topology environment parameters.
|
||||
ZK_SERVER="localhost:21811,localhost:21812,localhost:21813"
|
||||
TOPOLOGY_FLAGS="-topo_implementation zk2 -topo_global_server_address $ZK_SERVER -topo_global_root /vitess/global"
|
||||
|
||||
mkdir -p $VTDATAROOT/tmp
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ source $script_root/env.sh
|
|||
|
||||
echo "Starting vtworker..."
|
||||
exec $VTROOT/bin/vtworker \
|
||||
$TOPOLOGY_FLAGS \
|
||||
-cell test \
|
||||
-log_dir $VTDATAROOT/tmp \
|
||||
-alsologtostderr \
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
set -e
|
||||
|
||||
cell='test'
|
||||
web_port=15000
|
||||
grpc_port=15999
|
||||
|
||||
script_root=`dirname "${BASH_SOURCE}"`
|
||||
|
@ -13,6 +12,7 @@ source $script_root/env.sh
|
|||
|
||||
echo "Starting vtctld..."
|
||||
$VTROOT/bin/vtctld \
|
||||
$TOPOLOGY_FLAGS \
|
||||
-cell $cell \
|
||||
-web_dir $VTTOP/web/vtctld \
|
||||
-web_dir2 $VTTOP/web/vtctld2/app \
|
||||
|
@ -22,12 +22,11 @@ $VTROOT/bin/vtctld \
|
|||
-backup_storage_implementation file \
|
||||
-file_backup_storage_root $VTDATAROOT/backups \
|
||||
-log_dir $VTDATAROOT/tmp \
|
||||
-port $web_port \
|
||||
-port $vtctld_web_port \
|
||||
-grpc_port $grpc_port \
|
||||
-pid_file $VTDATAROOT/tmp/vtctld.pid \
|
||||
> $VTDATAROOT/tmp/vtctld.out 2>&1 &
|
||||
disown -a
|
||||
|
||||
echo "Access vtctld web UI at http://$hostname:$web_port"
|
||||
echo "Access vtctld web UI at http://$hostname:$vtctld_web_port"
|
||||
echo "Send commands with: vtctlclient -server $hostname:$grpc_port ..."
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ source $script_root/env.sh
|
|||
|
||||
# Start vtgate.
|
||||
$VTROOT/bin/vtgate \
|
||||
$TOPOLOGY_FLAGS \
|
||||
-log_dir $VTDATAROOT/tmp \
|
||||
-port $web_port \
|
||||
-grpc_port $grpc_port \
|
||||
|
|
|
@ -98,6 +98,7 @@ for uid_index in $uids; do
|
|||
|
||||
echo "Starting vttablet for $alias..."
|
||||
$VTROOT/bin/vttablet \
|
||||
$TOPOLOGY_FLAGS \
|
||||
-log_dir $VTDATAROOT/tmp \
|
||||
-tablet-path $alias \
|
||||
-tablet_hostname "$tablet_hostname" \
|
||||
|
@ -114,6 +115,7 @@ for uid_index in $uids; do
|
|||
-grpc_port $grpc_port \
|
||||
-service_map 'grpc-queryservice,grpc-tabletmanager,grpc-updatestream' \
|
||||
-pid_file $VTDATAROOT/$tablet_dir/vttablet.pid \
|
||||
-vtctld_addr http://$hostname:$vtctld_web_port/ \
|
||||
$dbconfig_flags \
|
||||
> $VTDATAROOT/$tablet_dir/vttablet.out 2>&1 &
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"test": "localhost:21811,localhost:21812,localhost:21813",
|
||||
"global": "localhost:21811,localhost:21812,localhost:21813"
|
||||
}
|
|
@ -35,3 +35,16 @@ for zkid in $zkids; do
|
|||
done
|
||||
|
||||
echo "Started zk servers."
|
||||
|
||||
# Now create the toplevel directories we'll need, if not there.
|
||||
$VTROOT/bin/zk -server $ZK_SERVER touch -p /vitess/global
|
||||
$VTROOT/bin/zk -server $ZK_SERVER touch -p /vitess/test
|
||||
|
||||
# And also add the CellInfo description for the 'test' cell.
|
||||
# If the node already exists, it's fine, means we used existing data.
|
||||
$VTROOT/bin/vtctl $TOPOLOGY_FLAGS AddCellInfo \
|
||||
-root /vitess/test \
|
||||
-server_address $ZK_SERVER \
|
||||
test || /bin/true
|
||||
|
||||
echo "Configured zk servers."
|
||||
|
|
Загрузка…
Ссылка в новой задаче