-
Notifications
You must be signed in to change notification settings - Fork 1
mysql cluster
Software Engineer edited this page Apr 29, 2019
·
9 revisions
- mysql_server_version represents the version of the MySQL Server on which the NDB Cluster release is based. For all NDB Cluster 7.5 and NDB Cluster 7.6 releases, this is “5.7”. ndb_engine_version is the version of the NDB storage engine used by this release of the NDB Cluster software. For 8.0, their version should be merged. Please take NOTES!!
@see file init_db_cluster.sh
$SVRT_SOFT/usr/bin/mysqld_safe --no-defaults \
--socket=$SVRT_RUN/mysql$SVRT_PORT.sock \
--datadir=/data/data$SVRT_PORT/datadir/ \
--secure-file-priv=$SVRT_RUN \
-P $((SVRT_PORT+1)) \
--user=$USER --ndbcluster --ndb-connectstring=127.0.0.1
#export SVRT_PORT=8888
cd $HOME
rm -f /etc/apt/sources.list.d/mysql.list
apt-get install -y lsb-release libaio1 libnuma1 libwrap0
cat > env.sh <<TT1
export VER_LSB_REL=$(lsb_release -sc)
export VER_MYSQL_CLUSTER=7.6
export VER_MYSQL=5.7
#export KEY_APT=8C718D3B5072E1F5
export KEY_APT=5072E1F5
export SVRT_PORT=\$*
export SVRT=\$HOME/server\$SVRT_PORT
export SVRT_SOFT=\$SVRT/soft
export SVRT_RUN=\$SVRT/run
export SVRT_WEB=\$SVRT-web
#docker: map the folder to data in launch sh
#export SVRT_DIR_DB=/data/data\$SVRT_PORT/datadir/
#export SVRT_DIR_CLUSTER=/data/data\$SVRT_PORT/datadir/cluster/
mkdir -p \$SVRT_RUN
mkdir -p \$SVRT_WEB
#export LD_LIBRARY_PATH="\$SVRT_SOFT/usr/lib/x86_64-linux-gnu:\$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="\$SVRT_SOFT/usr/lib/x86_64-linux-gnu:\$SVRT_SOFT/lib/x86_64-linux-gnu"
export VER_PHPFPM=7.2
export VER_MYSQLD=5.7
#export VER_NGINX=
TT1
echo SVRT_SOFT=$SVRT_SOFT
source env.sh $SVRT_PORT
echo SVRT_PORT=$SVRT_PORT
echo SVRT_SOFT=$SVRT_SOFT
echo VER_PHPFPM=$VER_PHPFPM
echo VER_MYSQLD=$VER_MYSQLD
echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
cat > /etc/apt/sources.list.d/mysql.list <<EEE
deb http://repo.mysql.com/apt/ubuntu/ ${VER_LSB_REL} mysql-apt-config
deb http://repo.mysql.com/apt/ubuntu/ ${VER_LSB_REL} mysql-cluster-${VER_MYSQL_CLUSTER}
deb http://repo.mysql.com/apt/ubuntu/ ${VER_LSB_REL} mysql-tools
deb-src http://repo.mysql.com/apt/ubuntu/ ${VER_LSB_REL} mysql-cluster-${VER_MYSQL_CLUSTER}
EEE
cat /etc/apt/sources.list.d/mysql.list
gpg --recv-keys ${KEY_APT}
apt-key adv --keyserver pgp.mit.edu --recv-keys ${KEY_APT}
apt-get update
rm -f *.deb
cat > download_pkg.sh <<TTT
PACKAGE=\$*
apt-get download \$PACKAGE
apt-cache depends -i \$PACKAGE | awk '/Depends:\s\w/ {print \$2}' | xargs apt-get download
TTT
sh download_pkg.sh mysql-client-$VER_MYSQL
sh download_pkg.sh mysql-server-core-$VER_MYSQL
sh download_pkg.sh mysql-cluster-community-server
sh download_pkg.sh mysql-cluster-community-management-server
sh download_pkg.sh mysql-cluster-community-client
sh download_pkg.sh mysql-cluster-community-data-node
ls -al *.deb
for f in *.deb ; do
dpkg -x $f $SVRT_SOFT
done
echo SVRT_SOFT=$SVRT_SOFT
#ls $SVRT_SOFT
sed "s#^lc-messages-dir\s*=.*#lc-messages-dir=$SVRT_SOFT/usr/share/mysql#g" -i $SVRT_SOFT/etc/mysql/mysql.conf.d/mysqld.cnf
ls -al $SVRT_SOFT/usr/bin/mysqld_safe
$SVRT_SOFT/usr/bin/mysqld_safe --help
$SVRT_SOFT/usr/sbin/mysqld --no-defaults \
--lc-messages-dir=$SVRT_SOFT/usr/share/mysql \
--socket=$SVRT_RUN/mysql$SVRT_PORT.sock \
--datadir=/data/data$SVRT_PORT/datadir/ \
--secure-file-priv=$SVRT_RUN \
--user=$USER --explicit_defaults_for_timestamp \
--verbose --help
mkdir -p /data/data$SVRT_PORT
#rm -rf /data/data$SVRT_PORT/datadir/
$SVRT_SOFT/usr/sbin/mysqld --no-defaults \
--lc-messages-dir=$SVRT_SOFT/usr/share/mysql \
--socket=$SVRT_RUN/mysql$SVRT_PORT.sock \
--datadir=/data/data$SVRT_PORT/datadir/ \
--initialize-insecure --user=$USER --explicit_defaults_for_timestamp
ls -al /data/data$SVRT_PORT/datadir/
#$SVRT_SOFT/etc/mysql/mysql.conf.d/mysqld.cnf
$SVRT_SOFT/usr/bin/mysqld_safe --no-defaults \
--socket=$SVRT_RUN/mysql$SVRT_PORT.sock \
--datadir=/data/data$SVRT_PORT/datadir/ \
--secure-file-priv=$SVRT_RUN \
-P $((SVRT_PORT+1)) \
--user=$USER --explicit_defaults_for_timestamp
## ip
$SVRT_SOFT/usr/bin/mysqladmin \
--host=127.0.0.1 \
--port=$((SVRT_PORT+1)) \
--user=root -p \
shutdown
## sock
$SVRT_SOFT/usr/bin/mysqladmin \
--socket=$SVRT_RUN/mysql$SVRT_PORT.sock \
--user=root -p \
shutdown
$SVRT_SOFT/usr/bin/mysqladmin \
--host=127.0.0.1 \
--port=$((SVRT_PORT+1)) \
--user=root -p \
variables
#VER_MYSQL_APT_CONFIG=0.8.11-1
### find config deb at official website https://dev.mysql.com/downloads/repo/apt/
## wget https://dev.mysql.com/get/mysql-apt-config_0.8.11-1_all.deb
#wget https://repo.mysql.com/mysql-apt-config_${VER_MYSQL_APT_CONFIG}_all.deb
#dpkg -i mysql-apt-config_${VER_MYSQL_APT_CONFIG}_all.deb
#echo "deb http://repo.mysql.com/apt/debian $(lsb_release -sc) mysql-cluster-7.6" | \
# tee /etc/apt/sources.list.d/mysql.list
- https://downloads.mysql.com/docs/mysql-apt-repo-quick-guide-en.pdf
- https://dev.mysql.com/doc/refman/5.7/en/mysql-cluster-online-add-node-example.html
$SVRT_SOFT/usr/sbin/ndb_mgmd -f cluster_config.ini --reload
$SVRT_SOFT/usr/bin/ndb_mgm 127.0.0.1 1186
Appendix B: Installing MySQL Non-interactively with MySQL APT Repository
For non-interactive installations of MySQL with the MySQL APT repository, answer the interactive
questions asked by the server package by setting the relevant debconf variables in, for example, your
installation script. These are the variables to set:
• root_password: This is the root password for the server installation.
• root_password_again: This is the root password, entered a second time for confirmation.
The following are steps from a sample script that set the debconf variables and then install MySQL noninteractively
by setting the environment variable DEBIAN_FRONTEND to noninteractive:
shell> sudo debconf-set-selections <<< "mysql-community-server mysql-community-server/root-pass password mypassword"
shell> sudo debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password mypassword"
shell> sudo DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-server
The password variables are erased automatically after MySQL has been installed, so they need to be set
again if the installation is to be repeated.