Category - IT技术

CentOS redis    2017-07-19 22:46:25    790

下载redis的安装包:http://download.redis.io/releases/redis-3.0.3.tar.gz

 

由于我的系统是刚装的,所以需要安装gcc才能编译成功,建议大家都先安装下gcc再安装文件
离线安装gcc方法,请看末尾
yum install gcc

然后再按照下面的方式执行

Installation

Download, extract and compile Redis with:

$ wget http://download.redis.io/releases/redis-3.0.3.tar.gz
$ tar xzf redis-3.0.3.tar.gz
$ cd redis-3.0.3
$ make

The binaries that are now compiled are available in the src directory. Run Redis with:

$ src/redis-server

You can interact with Redis using the built-in client:

$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
离线安装GCC方法
# rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm # rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm # rpm -ivh cpp-4.4.7-4.el6.x86_64.rpm # rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm # rpm -ivh gcc-4.4.7-4.el6.x86_64.rpm
离线包:http://pan.baidu.com/s/1i3lg73Z

 

by 刘迎光@萤火虫工作室
OpenBI交流群:495266201
MicroService 微服务交流群:217722918
mail: liuyg#liuyingguang.cn
博主首页(防止爬虫):http://blog.liuyingguang.cn
OpenBI问答社区:http://openbi.liuyingguang.cn/


 
Centos keepalived 虚拟IP    2017-07-19 22:45:23    841
下载keepalived

http://www.keepalived.org/software/


首先检查安装openssl-devel

yum install openssl-devel

如果是离线,借鉴文章:http://blog.csdn.net/gsying1474/article/details/48396205

# ./configure --prefix=/usr/local/keepalived --with-kernel-dir=/usr/src/kernels/2.6.32-279.el6.x86_64



当出现如下字样
Keepalived configuration
------------------------
Keepalived version       : 1.2.19
Compiler                 : gcc
Compiler flags           : -g -O2
Extra Lib                : -lssl -lcrypto -lcrypt
Use IPVS Framework       : Yes
IPVS sync daemon support : Yes
IPVS use libnl           : No
fwmark socket support    : Yes
Use VRRP Framework       : Yes
Use VRRP VMAC            : Yes
SNMP support             : No
SHA1 support             : No
Use Debug flags          : No

执行安装命令

# make 
# make install


设置keepalived开机启动脚本

cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/

cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/

cp /usr/local/keepalived/sbin/keepalived /usr/sbin/

chkconfig keepalived on

新建一个配置文件,默认keepalived启

SELINUX MariaDB    2017-07-19 22:41:48    1448
150812 23:38:24 [ERROR] WSREP: Permission denied
150812 23:38:24 [ERROR] WSREP: failed to open gcomm backend connection: 13: error while trying to listen 'tcp://0.0.0.0:4567?socket.non_blocking=1', asio error 'Permission denied': 13 (Permission denied)
  at gcomm/src/asio_tcp.cpp:listen():777
150812 23:38:24 [ERROR] WSREP: gcs/src/gcs_core.cpp:long int gcs_core_open(gcs_core_t*, const char*, const char*, bool)():206: Failed to open backend connection: -13 (Permission denied)
150812 23:38:24 [ERROR] WSREP: gcs/src/gcs.cpp:long int gcs_open(gcs_conn_t*, const char*, const char*, bool)():1379: Failed to open channel 'galera_cluster' at 'gcomm://192.168.100.220': -13 (Permission denied)
150812 23:38:24 [ERROR] WSREP: gcs connect failed: Permission denied
150812 23:38:24 [ERROR] WSREP: wsrep::connect() failed: 7
150812 23:38:24 [ERROR] Aborting




原因:

由于开启了SELINUX。

解决方法:

编辑文件/etc/sysconfig/selinux

把SELINUX设为disabled

重启后就会忽略selinux,或者直接执行命令

setenforce 0

立即生效。


 


 

by 刘迎光@萤火虫工作室
OpenBI交流群:495266201
MicroService 微服务交

Percona-xtrabackup    2017-07-19 22:39:16    1235

Xtrabackup是什么Xtrabackup是一个对MySQL InnoDB做数据备份的工具,支持在线热备份(备份时不影响数据读写),是商业备份工具InnoDB Hotbackup的一个很好的替代品。

Xtrabackup有两个主要的工具:xtrabackup、innobackupex1.xtrabackup只能备份InnoDB和XtraDB两种数据表,而不能备份MyISAM数据表2.innobackupex是参考了InnoDB Hotbackup的innoback脚本修改而来的.innobackupex是一个perl脚本封装,封装了xtrabackup。主要是为了方便的同时备份InnoDB和MyISAM引擎的表,但在处理myisam时需要加一个读锁。并且加入了一些使用的选项。如slave-info可以记录备份恢复后,作为slave需要的一些信息,根据这些信息,可以很方便的利用备份来重做slave。

工具/原料

  • Ubuntu 13.10_X64+MySQL-server-5.5.35+percona-xtrabackup-2.1.7

方法/步骤

  1. 源码下载:http://www.percona.com/redir/downloads/XtraBackup/XtraBackup-2.1.7/binary/Linux/x86_64/percona-xtrabackup-2.1.7-721-Linux-x86_64.tar.gz

  2. 源码解压:tar -xzvf percona-xtrabackup-2.1.7-721-Linux-x86_64.tar.gz

  3. cd percona-xtrabackup-2.1.7-Linux-x86_64/bin/

  4. ll

    drwxr-xr-x 2 master master     4096 Jan 23 22:12 ./

    drwxr-xr-x 4 master master     4096 Jan 23 22:05 ../

    -rwxr-xr-x 1 master master   169816 Jan 23 22:12 innobackupex*

    lrwxrwxrwx 1 master master       12 Jan 23 22:12 innobackupex-1.5.1 -> innobackupex*

    -rwxr-xr-x 1 master maste

2017-07-19 22:38:06    1356
参考文章:http://www.ttlsa.com/mysql/mysql-high-availability-with-nginx-and-galera/

借鉴文档:http://www.unixmen.com/setup-mariadb-galera-cluster-10-0-centos/


MariaDB is a relational database management system (RDBMS) and  MariaDB Galera Cluster is a synchronous multi-master cluster for MariaDB. It is available on Linux only, and only supports theXtraDB/InnoDB storage engines. This article explains how to setup MariaDB Galera Cluster 10.0 with 3 nodes running on CentOS 6.5 x86_64 resulting in a HA (high-availability) database cluster.

CLUSTER DETAILS

We using 3 freshly deployed VMs running a minimal install of CentOS 6.5 x86_64.

Cluster node 1 has hostname db1 and IP address 1.1.1.1
Cluster node 2 has hostname db2 and IP address 1.1.1.2
Cluster node 3 has hostname db3 and IP address 1.1.1.3

Step 1: Add MariaDB Repositories

Create a mariadb repository /etc/yum.repos.d/mariadb.repo using following content in your system.

For CentOS 6 – 64bit:

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/c
8/26