软件环境:centos7.3,glib-2.49,lua5.1,Atlas2.2.1,mysql5.7

依赖包安装
****************************************************************************************

lua安装
-------------------------------------------
yum install -y libtermcap-devel ncurses-devel libevent-devel readline-devel
tar -zxvf lua-5.1.5.tar.gz
chown -R root.root *
cd lua-5.1.5/

修改当前目录下的“Makefile”中的 INSTALL_TOP= /usr/local为 INSTALL_TOP= /usr/local/lua
主要是为了避免与系统自带的lua库发生冲突的可能
vim Makefile
INSTALL_TOP= /usr/local/lua
make linux install

glib-2.49安装
----------------------------------------
rpm -q ncurses readline readline-devel lua libffi libffi-devel libiconv xz glib2 cmake popt libnl libevent libevent-devel openssl-devel libtermcap-devel ncurses-devel
yum install -y libffi-devel libtermcap-devel
http://www.rpmfind.net/linux/rpm2html/search.php?query=libevent-devel
rpm -ivh libevent-devel-2.0.21-4.el7.x86_64.rpm

libiconv依赖包
tar xvzf libiconv-1.14.tar.gz
chown -R root.root *
cd libiconv-1.14
cd srclib
sed -i -e '/gets is a security/d' ./stdio.in.h
cd ..
注意不要建立独立目录,一定要安装在/usr/local目录下,不然安装glib时会报/usr/bin/ld: cannot find -liconv
./configure --prefix=/usr/local gl_cv_header_working_stdint_h=yes
make
make install

pkg安装
tar -zxvf pkg-config-0.29.2.tar.gz
chown -R root.root *
cd pkg-config-0.29.2/
./configure --enable-iconv=no --with-libiconv=gnu --with-internal-glib
make
make install

ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/libiconv.so.2
pkg-config --version
0.29.2

pcre安装
tar -zxvf pcre-8.39.tar.gz
chown -R root.root *
cd pcre-8.39/
./configure --enable-utf8 --enable-unicode-properties
make
make install
ln -s /usr/local/lib/libpcre.so.1 /lib
ln -s /usr/local/lib/libpcreposix.so.0 /lib

glib安装
rpm -q libffi-devel
xz -d glib-2.49.7.tar.xz
chown -R root.root *
tar -xvf glib-2.49.7.tar

mkdir /usr/local/glib-2.49.7
cd glib-2.49.7/
./configure --prefix=/usr/local/glib-2.49.7 --with-libiconv=gnu LIBFFI_CFLAGS="-I/usr/local/include" LIBFFI_LIBS="-L/usr/local/lib -lffi"
make
make install

配置PKG-CONFIG
# find /usr/ -name pkgconfig
/usr/lib64/pkgconfig
/usr/share/pkgconfig
/usr/local/lib/pkgconfig
/usr/local/lib64/pkgconfig
/usr/local/mysql/lib/pkgconfig
/usr/local/glib-2.49.7/lib/pkgconfig

# cd /usr/local/glib-2.49.7/lib/pkgconfig
# ls
gio-2.0.pc gio-unix-2.0.pc glib-2.0.pc gmodule-2.0.pc gmodule-export-2.0.pc gmodule-no-export-2.0.pc gobject-2.0.pc gthread-2.0.pc

vim .bash_profile
export PKG_CONFIG_PATH=/usr/local/glib-2.49.7/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/usr/local/mysql/lib/pkgconfig:$PKG_CONFIG_PATH
. ./.bash_profile

测试glib pkg
vim hello.c
#include <stdio.h>
#include <glib.h>
int main(int argc, char** argv){
GList* list=NULL;
list=g_list_append(list,"Hello world!");
list=g_list_append(list,"made by pcat");
list=g_list_append(list,"http://www.cnblogs.com/perfei/");
printf("The first item is %s\n",g_list_first(list)->data);
return 0;
}

编译如下:
gcc hello.c -o hello $(pkg-config --cflags --libs glib-2.0)

# ls -ltr | grep hello
-rw-r--r-- 1 root root 305 11月 20 16:47 hello.c
-rwxr-xr-x 1 root root 8648 11月 20 17:05 hello

# ./hello
The first item is Hello world!

Atlas数据库中间件安装配置
****************************************************************************************

安装
--------------------------------------------------------------------------------------------
tar -zxvf Atlas-2.2.1.tar.gz
chown -R root.root *
cd Atlas-2.2.1/
mkdir /usr/local/mysql-proxy
./configure --prefix=/usr/local/mysql-proxy \
--with-lua=/usr/local/lua \
--with-mysql=/usr/local/mysql \
GLIB_CFLAGS="-I/usr/local/glib-2.49.7/include/glib-2.0" \
GLIB_LIBS="-L/usr/local/glib-2.49.7/lib/ -lglib-2.0" \
GMODULE_CFLAGS="-I/usr/local/glib-2.49.7/include" \
GMODULE_LIBS="-L/usr/local/glib-2.49.7/lib -lgmodule-2.0" \
GTHREAD_CFLAGS="-I/usr/local/glib-2.49.7/include" \
GTHREAD_LIBS="-L/usr/local/glib-2.49.7/lib -lgthread-2.0" \
LUA_CFLAGS="-I/usr/local/lua/include" \
LUA_LIBS="-L/usr/local/lua/lib -llua-5.1" \
CFLAGS="-DHAVE_LUA_H -O2" \
LDFLAGS="-L/usr/local/lib -L/usr/local/lib64 -lm -ldl -lcrypto"

Atlas2.2.1 对应的是 mysql5.6 的版本,使用mysql5.7时需要进行以下调整
共四处需要替换,详见错误信息
vim src/network-mysqld-packet.c
:%s/CLIENT_SECURE_CONNECTION/CLIENT_RESERVED2/g
共一处需要替换,详见错误信息
vim ./plugins/admin/admin-plugin.c
:%s/CLIENT_SECURE_CONNECTION/CLIENT_RESERVED2/g

make
make如果报错处理,可进行以下处理
ln -s /usr/local/glib-2.49.7/lib/glib-2.0/include/glibconfig.h /usr/local/glib-2.49.7/include/glib-2.0

make install
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/mysql-proxy/lib/mysql-proxy/plugins

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variableduring execution
- add LIBDIR to the `LD_RUN_PATH' environment variableduring linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

cd /usr/local
mv mysql-proxy atlas-2.2.1 && ln -s atlas-2.2.1 mysql-proxy

配置文件
--------------------------------------------------------------------------------------------
/usr/local/mysql-proxy/bin/encrypt Admin_123
ywy55weCQG6TZ6zxvGQr9A==
/usr/local/mysql-proxy/bin/encrypt rootroot
MdUKAaW7vcwa8s/oWZlMvQ==

vim /usr/local/mysql-proxy/conf/atlas.cnf
[mysql-proxy]
admin-username = atlasadmin
admin-password = Admin_123

proxy-backend-addresses = 10.168.21.186:3306
proxy-read-only-backend-addresses = 10.168.21.186:3306@1,10.168.21.187:3306@2,10.168.21.188:3306@2

pwds = admin:ywy55weCQG6TZ6zxvGQr9A==,root:MdUKAaW7vcwa8s/oWZlMvQ==

daemon = true
keepalive = true
event-threads = 16

log-level = message
log-path = /usr/local/mysql-proxy/log
sql-log = ON

proxy-address = 0.0.0.0:3309
admin-address = 0.0.0.0:3307

charset = utf8

启动
--------------------------------------------------------------------------------------------
/usr/local/mysql-proxy/bin/mysql-proxyd atlas start
OK: MySQL-Proxy of atlas is started

# ps -ef | grep atlas
root 26516 1 0 14:42 ? 00:00:00 /usr/local/mysql-proxy/bin/mysql-proxy --defaults-file=/usr/local/mysql-proxy/conf/atlas.cnf
root 26517 26516 0 14:42 ? 00:00:00 /usr/local/mysql-proxy/bin/mysql-proxy --defaults-file=/usr/local/mysql-proxy/conf/atlas.cnf

启动脚本
# vim /etc/init.d/atlas

#!/bin/sh
#
# mysql-proxy This script starts and stops the mysql-proxy daemon
#
# chkconfig: - 78 30
# processname: mysql-proxy
# description: mysql-proxy is a proxy daemon to mysql
# config: /usr/local/mysql-proxy/conf/mysql-proxy.cnf
# pidfile: /usr/local/mysql-proxy/log/mysql-proxy.pid
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

DAEMON="/usr/local/mysql-proxy/bin/mysql-proxy"
CONFIGFILE="/usr/local/mysql-proxy/conf/atlas.cnf"
PIDFILE="/usr/local/mysql-proxy/log/mysql-proxy.pid"
LOCKFILE="/var/lock/subsys/mysql-proxy"
PROG=`basename $DAEMON`

RETVAL=0

start() {
echo -n $"Starting ${PROG}......"
[ -x $DAEMON ] || exit 5
[ -f $CONFIGFILE ] || exit 6
${DAEMON} --defaults-file=${CONFIGFILE} || echo -n "${PROG} already running"

RETVAL=$?
echo
[[ $RETVAL -eq 0 ]] && touch $LOCKFILE

return $RETVAL
}

stop() {
echo -n $"Stopping ${PROG}......"
if [[ `ps aux | grep bin/mysql-proxy | grep -v grep | wc -l` -gt 0 ]]; then
kill -TERM `ps -A -oppid,pid,cmd | grep bin/mysql-proxy | grep -v grep | awk '{print $2}'`
fi

RETVAL=$?
echo
[[ $RETVAL -eq 0 ]] && rm -f $LOCKFILE $PIDFILE

return $RETVAL
}

restart() {
stop
sleep 1
start
}

case "$1" in
start)
start
;;

stop)
stop
;;

restart)
restart
;;

condrestart)
[[ -e $LOCKFILE ]] && restart
;;

*)
echo "Usage: $0 {start|stop|restart|condrestart}"
RETVAL=1
;;
esac

exit $RETVAL

chmod +x /etc/init.d/atlas
chmod 0660 /usr/local/mysql-proxy/conf/atlas.cnf
service atlas stop
service atlas start

# service atlas stop
Stopping mysql-proxy......
# service atlas start
Unit atlas.service could not be found.
Starting mysql-proxy......

# /etc/init.d/atlas stop
Stopping mysql-proxy......
# /etc/init.d/atlas start
Starting mysql-proxy......

# ps -ef | grep atlas
root 27560 1 0 14:49 ? 00:00:00 /usr/local/mysql-proxy/bin/mysql-proxy --defaults-file=/usr/local/mysql-proxy/conf/atlas.cnf
root 27561 27560 0 14:49 ? 00:00:00 /usr/local/mysql-proxy/bin/mysql-proxy --defaults-file=/usr/local/mysql-proxy/conf/atlas.cnf
root 27591 15666 0 14:49 pts/1 00:00:00 grep --color=auto atlas

连接
------------------------------------------------------------------

管理接口登录,即DBA数据库管理使用的接口
# mysql -h127.0.0.1 -P3307 -uatlasadmin -pAdmin_123
[oracle@12cgc oms]$ mysql -h10.168.21.187 -P3307 -uatlasadmin -pAdmin_123
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.99-agent-admin

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select * from help;
+-------------------------------+---------------------------------------------------------+
| command | description |
+-------------------------------+---------------------------------------------------------+
| SELECT * FROM help | shows this help |
| SELECT * FROM backends | lists the backends and their state |
| SET OFFLINE $backend_id | offline backend server, $backend_id is backend_ndx's id |
| SET ONLINE $backend_id | online backend server, ... |
| ADD MASTER $backend | example: "add master 127.0.0.1:3306", ... |
| ADD SLAVE $backend | example: "add slave 127.0.0.1:3306", ... |
| REMOVE BACKEND $backend_id | example: "remove backend 1", ... |
| SELECT * FROM clients | lists the clients |
| ADD CLIENT $client | example: "add client 192.168.1.2", ... |
| REMOVE CLIENT $client | example: "remove client 192.168.1.2", ... |
| SELECT * FROM pwds | lists the pwds |
| ADD PWD $pwd | example: "add pwd user:raw_password", ... |
| ADD ENPWD $pwd | example: "add enpwd user:encrypted_password", ... |
| REMOVE PWD $pwd | example: "remove pwd user", ... |
| SAVE CONFIG | save the backends to config file |
| SELECT VERSION | display the version of Atlas |
+----------------------------+---------------------------------------------------------+
16 rows in set (0.00 sec)

工作接口,即应用访问的接口
# mysql -h10.168.21.187 -P3309 -uadmin -pAdmin_123

[oracle@12cgc oms]$ mysql -h10.168.21.187 -P3309 -uadmin -pAdmin_123
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.81-log MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.17 sec)

转载于:https://www.cnblogs.com/perfei/p/7879647.html

my02_Atlas mysql5.7安装配置相关推荐

  1. mysql5.5安装配置 在阿里云服务器上 本地navicat连接

    MySQL 5.5安装配置教程. 2018年03月20日 19:18:49 沸点数据 阅读数 18046 1.官网下载MySQL 5.5. 下载地址:https://dev.mysql.com/dow ...

  2. Mysql5.7安装配置(For Windows)

    一.安装步骤: 1.官网下载5.7版本zip压缩包: MySQL :: Download MySQL Community Server (Archived Versions) 2.解压至本地安装目录, ...

  3. 大数据开发系列(六)----Hive3.0.0安装配置以及Mysql5.7安装配置

    一.Hive3.0.0安装配置:    (Hive3.1.2有BUG)hadoop3.1.2 Hive各个版本下载地址: http://archive.apache.org/dist/hive/,这里 ...

  4. mysql5.6 安装配置 老系统_mysql 5.6 从陌生到熟练之-安装配置(windows系统)

    mysql配置 1.安装文件的下载 免安装版下载地址 :http://dev.mysql.com/downloads/file.php?id=452189 下载后是一个压缩文件,解压后放在你想放的位置 ...

  5. mysql5.7安装配置

    我的电脑->属性->高级->环境变量 选择PATH,在其后面添加: 你的mysql bin文件夹的路径 (如:C:\Program Files\MySQL\MySQL Server ...

  6. Centos7:mysql5.6安装,配置及使用(RPM方式)

    1.首先安装好jdk环境,本机所用环境为jdk1.8 2.卸载MariaDB(Centos7自带)与Mysql 2.1卸载:MariaDB #rpm -qa | grep -i mariadb //查 ...

  7. mysql5.7安装教程centos_CentOS7下MySQL5.7安装配置方法图文教程(YUM)

    安装环境:CentOS7 64位,MySQL5.7 1.配置YUM源 在MySQL官网中下载YUM源rpm安装包:http://dev.mysql.com/downloads/repo/yum/ # ...

  8. mysql5.6 安装配置 老系统_Windows系统 Mysql5.6下载安装以及配置

    一:下载(借鉴:https://wenda.so.com/q/1470863138729940) 1.网址:https://dev.MysqL.com/downloads/MysqL/5.6.html ...

  9. centos6.8 mysql5.6_Centos6.8 Mysql5.6 安装配置教程(转)

    mysql 配置: 1:编辑配置文件: vi /etc/my.cnf 2:修改配置如下: [client] password        = 123456 port            = 330 ...

最新文章

  1. 实现简书个人中心UI效果
  2. 【Android 应用开发】Ubuntu 下 Android Studio 开发工具使用详解 (旧版本 | 仅作参考)
  3. 关于pipeline
  4. 程序猿段子_【新年新气象】今年,能为程序员男友做点什么?
  5. ES6_入门(1)_let命令
  6. python编写脚本方法_python 定时器,实现每天凌晨3点执行的方法
  7. python编程计算器_Python编程之计算器/字符及界面
  8. linux tcp文件分包_在Linux下基于TCP协议的文件传输程序.
  9. Ruby之旅(16) 异常处理 rescue与ensure
  10. PyKeyBoardFairy可以替代你游戏中的卡键盘和鼠标宏
  11. Tews Technologies TPMC871 PCMCIA PMC 接口模块
  12. 第五章 多元函数微分学
  13. h264参数动态调整
  14. R语言一步到位求数据的均值,频数,标准差,标准误差
  15. 宏病毒的研究与实例分析04——实战分析
  16. 五步帮你实现用户画像的数据加工
  17. 2019/07/03 分布式系统概述(01)
  18. 排队论和对策论(博弈论)
  19. 科目二练习与考试点位总结
  20. wangEditor图片上传

热门文章

  1. Java文件操作大全(绝对的经典,值得收藏!)
  2. Matlab中下标,斜体,及希腊字母的使用方法
  3. 如何写一个完善的c++异常处理类
  4. OpenCV之objdetect 模块. 物体检测:级联分类器
  5. Scala基础教程(五):函数、闭包
  6. Day 22: 使用Spring、MongoDB和AngularJS开发单页面应用
  7. 软件构造第三章 第五部分
  8. Debian Security Advisory(Debian安全报告) DSA-4407-1 xmltooling
  9. 使用WMI对象收集计算机信息
  10. Linux操作系统上的mysql安装