一、准备工作
数据库版本:V2.3.2
操作系统版本:Red Hat Enterprise Linux Server release 7.2 (Maipo)【查询命令:cat /etc/redhat-release】
下载上传数据库安装包:teledb-for-mysql-master.zip
下载上传boost安装包:
wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
下载上传依赖包:
cmake-2.8.12.2-2.el7.x86_64.rpm
rh-varnish6-runtime-4.1-6.el7.x86_64.rpm
rh-varnish6-jemalloc-5.0.1-3.el7.x86_64.rpm
rh-varnish6-jemalloc-devel-5.0.1-3.el7.x86_64.rpm
ncurses-base-5.9-14.20130511.el7_4.noarch.rpm
ncurses-libs-5.9-14.20130511.el7_4.x86_64.rpm
ncurses-5.9-14.20130511.el7_4.x86_64.rpm
ncurses-devel-5.9-14.20130511.el7_4.x86_64.rpm
二、环境部署
1.创建用户、用户组
groupadd teledb
useradd teledb -g teledb
2.创建相关目录
mkdir -p /opt/teledb-2.3.2/data
3.安装boost(已上传到/opt/下)
cd /opt/
tar xzf boost_1_59_0.tar.gz
cd boost_1_59_0
./bootstrap.sh
./b2 install
4.安装依赖包(已上传到/opt/下)【有外网的话最好用yum安装】
yum方式安装
yum -y install gcc gcc-c++ ncurses ncurses-devel cmake jemalloc jemalloc-devel
rpm方式安装:(版本冲突在后面加--force)
cd /opt/
rpm -ivh cmake-2.8.12.2-2.el7.x86_64.rpm
rpm -ivh rh-varnish6-runtime-4.1-6.el7.x86_64.rpm
rpm -ivh rh-varnish6-jemalloc-5.0.1-3.el7.x86_64.rpm
rpm -ivh rh-varnish6-jemalloc-devel-5.0.1-3.el7.x86_64.rpm
rpm -ivh ncurses-base-5.9-14.20130511.el7_4.noarch.rpm
rpm -ivh ncurses-libs-5.9-14.20130511.el7_4.x86_64.rpm
rpm -ivh ncurses-5.9-14.20130511.el7_4.x86_64.rpm
rpm -ivh ncurses-devel-5.9-14.20130511.el7_4.x86_64.rpm
三、安装
1.解压安装包(安装包已上传到/opt/下)
cd /opt/
unzip teledb-for-mysql-master.zip
2.cmake编译
cd /opt/teledb-for-mysql-master
cmake -DCMAKE_INSTALL_PREFIX=/opt/teledb-2.3.2 -DMYSQL_DATADIR=/opt/teledb-2.3.2/data -DSYSCONFDIR=/opt/teledb-2.3.2 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/opt/boost_1_59_0 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/opt/teledb-2.3.2/mysql.sock -DMYSQL_TCP_PORT=4406 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make
make install
3.参数配置文件
即my.cnf,以下仅供参考,不作最适配置。
[client]
port = 4406
socket = /opt/teledb-2.3.2/mysql.sock
default-character-set = utf8mb4
[mysqld]
port = 4406
socket = /opt/teledb-2.3.2/mysql.sock
basedir = /opt/teledb-2.3.2
datadir = /opt/teledb-2.3.2/data
pid-file = /opt/teledb-2.3.2/teledb.pid
log_error = /opt/teledb-2.3.2/mysql-error.log
user = mysql
default_storage_engine = InnoDB
max_connections = 1000
max_connect_errors = 6000
open_files_limit = 65535
table_open_cache = 128
max_allowed_packet = 64M
binlog_cache_size = 128M
max_heap_table_size = 128M
tmp_table_size = 128M
sort_buffer_size = 64M
join_buffer_size = 64M
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 1024M
innodb_log_buffer_size = 128M
innodb_log_file_size = 256M
4.修改目录所属用户
chown -R teledb:teledb /opt/teledb-2.3.2
5.初始化实例
cd /opt/teledb-2.3.2/bin
./mysqld --initialize-insecure --user=teledb --basedir=/opt/teledb-2.3.2 --datadir=/opt/teledb-2.3.2/data
备注:
--initialize进行初始化会在console里输出一个随机密码
--initialize-insecure进行初始化root密码为空
6.配置服务
cp /opt/teledb-2.3.2/support-files/mysql.server /etc/init.d/teledb
#vi /etc/init.d/teledb
#若my.cnf存放到/etc/my.cnf则不需要修改
chmod +x /etc/init.d/teledb
chkconfig --add teledb
chkconfig teledb on
关于修改vi /etc/init.d/teledb的详细说明:修改里面的basedir(在文件前部分指定一下)、datadir(在文件前部分指定一下)、my.cnf为实际的路径,搜索一下mysqld_safe,在该命令前添加--defaults-file参数来指定参数文件,否则默认寻找/etc/my.cnf。
7.启动数据库
service teledb start
或systemctl start teledb
8.连接数据库
cd /opt/teledb-2.3.2/bin
./mysql -uroot -p
9.修改root密码
mysql> use mysql;
mysql> select host, user from user;
mysql> update mysql.user set host='%' where user='root';
mysql> alter user 'root'@'%' identified by '123456';
mysql> flush privileges;




