【直接从word拷贝出来的,格式有点混乱,以后我调整】
1.1 安装包
redis-4.0.6.tar.gz。
1.2 安装依赖
--make redis时提示gcc: Command not found 需要执行下面命令:
yum install gcc zlib ruby rubygems
--启动集群的机器需要安装gpg2、rvm,其他机器不需要
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
curl -L get.rvm.io | bash -s stable
find / -name rvm –print
--此外,运行以下命令加载rvm环境。
source /etc/profile.d/rvm.sh
rvm reload
rvm install 2.4.1
rvm use 2.4.1
rvm use 2.4.1 –default
rvm remove 1.8.7(可不执行)
ruby --version
gem install redis
1.3 步骤
2.3.1 安装:
|
wget http://download.redis.io/releases/redis-4.0.6.tar.gz
tar zxvf redis-4.0.6.tar.gz
cd redis-4.0.6
mkdir /data
make
make PREFIX=/data/redis install
mkdir /data/redis/conf
mkdir /data/redis/log
|
2.3.2 配置:
|
cp /home/vic/redis-4.0.6/redis.conf /data/redis/conf/
mkdir /data/redis/{7000,7001,7002,7003,7004,7005}
--启动集群需要,其他机器不需要
cp /home/vic/redis-4.0.6/src/redis-trib.rb /data/redis/bin/
需要修改的congf的配置项
<v:shape id="图片_x0020_9" o:spid="_x0000_i1029" type="#_x0000_t75" style="width:453.75pt;height:112.5pt;
visibility:visible;mso-wrap-style:square"><v:imagedata src="file:///C:\Users\ZHANGZ~1\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png" o:title=""></v:imagedata></v:shape>
2.3.3 启动:
/data/redis/bin/redis-server /data/redis/conf/7000.conf
/data/redis/bin/redis-server /data/redis/conf/7001.conf
/data/redis/bin/redis-server /data/redis/conf/7002.conf
/data/redis/bin/redis-server /data/redis/conf/7003.conf
/data/redis/bin/redis-server /data/redis/conf/7004.conf
/data/redis/bin/redis-server /data/redis/conf/7005.conf
--关联启动集群
/data/redis/bin/redis-trib.rb create --replicas 1 10.23.22.42:7000 10.23.22.42:7001 10.23.22.42:7002 10.23.22.42:7003 10.23.22.42:7004 10.23.22.42:7005
|
1.4 管理工具cachecloude
1.4.1 环境需求
Java 7+
Maven 3
Mysql
Redis 3
1.4.2 mysql安装
rpm -qa |grep mariadb
rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
yum install -y gcc gcc-c++ cmake ncurses-devel bison autoconf libaio libaio-devel perl-Data-Dumper
useradd -s /sbin/nologin mysql
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql/
tar zxvf mysql-5.6.11.tar.gz
cd mysql-5.6.11
cmake -DMYSQL_USER=mysql -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DINSTALL_DATADIR=/data/mysql/data -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1
make
make install
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig mysqld on
echo "export PATH=/usr/local/mysql/bin/:$PATH" >> /etc/profile
source /etc/profile
/usr/local/mysql/scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/data
在/etc/my.cnf加入如下配置
basedir=/usr/local/mysql
datadir=/data/mysql/data
socket=/tmp/mysqld.sock
/etc/init.d/mysqld start
mysql -u root -p
password '123456'
密码修改为123123:
grant all on . to 'root'@'localhost' identified by '123123' with grant option;
grant all on . to 'root'@'%' identified by '123123';
1.4.3 redis-cachecloud安装和启动
1)创建数据库&导入数据
create database cachecloud;
grant all on cachecloud.* to 'admin@'localhost' identified by 'admin';
grant all on cachecloud.* to 'admin'@'%' identified by 'admin';
flush privileges;
use cachecloud;
source /usr/local/cachecloud-master/script/cachecloud.sql;
2)修改cachecloud-master下的配置文件
/usr/local/cachecloud-master/cachecloud-open-web/src/main/swap/online.properties
/usr/local/cachecloud-master/cachecloud-open-web/src/main/swap/local.propertie
|
cachecloud.db.url = jdbc:mysql://127.0.0.1:3306/cachecloud
cachecloud.db.user = admin
cachecloud.db.password = admin
cachecloud.maxPoolSize = 20
isClustered = true
isDebug = false
spring-file=classpath:spring/spring-online.xml
log_base=/opt/cachecloud-web/logs
web.port=8585
log.level=WARN
|
3)maven安装和编译cachecloud-open-web
tar zxvf apache-maven-3.3.9-bin.tar.gz
mv apache-maven-3.3.9 /usr/local/maven
cd /usr/local/cachecloud-master/cachecloud-open-web
/usr/local/maven/bin/mvn clean compile install –Ponline
4)上传cachecloud-open-web-1.0-SNAPSHOT.war和cachecloud-web.conf
mkdir -p /opt/cachecloud-web
cp /usr/local/cachecloud-master/cachecloud-open-web/target/cachecloud-open-web-1.0-SNAPSHOT.war /opt/cachecloud-web/
cp /usr/local/cachecloud-master/cachecloud-open-web/src/main/resources/cachecloud-web.conf /opt/cachecloud-web/
ln -s /opt/cachecloud-web/cachecloud-open-web-1.0-SNAPSHOT.war /etc/init.d/cachecloudweb
chmod +x /etc/init.d/cachecloudweb
启动命令:
/etc/init.d/cachecloudweb start
1.4.4 配置集群监控
通过http://IP:8585访问,用户名和密码admin
1)机器管理
2)应用导入