四十四、Redis云平台CacheCloud搭建之源码部署

                 Redis云平台CacheCloud搭建之源码部署

1、Maven 安装

创建maven文件夹:
mkdir /usr/local/maven

进入maven文件夹:
cd /usr/local/maven

下载maven安装包并解压到maven文件夹:
wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.tar.gz

解压:
tar -xvf apache-maven-3.2.5-bin.tar.gz

配置环境变量:
vim /etc/profile
在文件末尾添加:
export M2_HOME=/usr/local/maven/apache-maven-3.2.5  //maven包所在路径
export PATH=${PATH}:${M2_HOME}/bin

使配置文件生效:
source /etc/profile

查看maven版本:
mvn -v

在settings.xml文件中配置阿里云镜像:
cd /usr/local/maven/apache-maven-3.2.5/conf
vim settings.xml
在节点下添加:
  
    nexus-aliyun  
    central    
    Nexus aliyun  
    http://maven.aliyun.com/nexus/content/groups/public  


查看当前生效的settings.xml:
mvn help:effective-settings

2、MySQL安装与卸载

查看是否安装mysql:
rpm -qa | grep mysql

普通删除:
rpm -e mysql 
强力删除:
rpm -e --nodeps mysql

查看yum上提供的数据库可下载版本:
yum list | grep mysql

在线安装MySQL:
yum -y install mysql mysql-server mysql-devel

登录mysql:
[root@localhost /]#  mysql -u root

更改密码root用户的密码为root:
mysql> grant all privileges on *.* to 'root'@'localhost' identified by 'root' with grant option;

启动方式:
service mysqld start

停止方式:
service mysqld stop

查看是否开机自动启动:
chkconfig --list | grep mysqld
如果2~5的都是on说明是开机自动启动,否则如果不是。

设置成开机自动启动:
chkconfig mysqld on


登录mysql客户端:
[root@redis cachecloud-web]#  mysql -u root -h 127.0.0.1 -p
Enter password: 

创建cachecloud数据库:
mysql>create database cachecloud;
mysql> use cachecloud;
mysql>grant all on cachecloud.* to 'admin'@'localhost' identified by 'admin';
mysql>flush privileges;

加载sql脚本文件,创建数据库:
mysql>  source /usr/local/cachecloud-master/script/cachecloud.sql

查看数据库:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cache_cloud        |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

切换数据库:
mysql> use cachecloud;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

查看数据库表:
mysql> show tables;
+---------------------------------------+
| Tables_in_cache_cloud                 |
+---------------------------------------+
| QRTZ_BLOB_TRIGGERS                    |
| QRTZ_CALENDARS                        |
| QRTZ_CRON_TRIGGERS                    |
| QRTZ_FIRED_TRIGGERS                   |
| QRTZ_JOB_DETAILS                      |
| QRTZ_LOCKS                            |
| QRTZ_PAUSED_TRIGGER_GRPS              |
| QRTZ_SCHEDULER_STATE                  |
| QRTZ_SIMPLE_TRIGGERS                  |
| QRTZ_SIMPROP_TRIGGERS                 |
| QRTZ_TRIGGERS                         |
| app_audit                             |
| app_audit_log                         |
| app_client_costtime_minute_stat       |
| app_client_costtime_minute_stat_total |
| app_client_datasize_minute_stat       |
| app_client_exception_minute_stat      |
| app_client_instance                   |
| app_client_value_distri_minute_stat   |
| app_client_value_minute_stats         |
| app_client_version_statistic          |
| app_data_migrate_status               |
| app_desc                              |
| app_hour_command_statistics           |
| app_hour_statistics                   |
| app_minute_command_statistics         |
| app_minute_statistics                 |
| app_to_user                           |
| app_user                              |
| instance_config                       |
| instance_fault                        |
| instance_host                         |
| instance_info                         |
| instance_slow_log                     |
| instance_statistics                   |
| machine_info                          |
| machine_statistics                    |
| server                                |
| server_stat                           |
| standard_statistics                   |
| system_config                         |
+---------------------------------------+
41 rows in set (0.00 sec)

mysql> exit

3、CacheCloud云平台下载

官网  https://github.com/sohutv/cachecloud

下载cachecloud-master.zip

解压并移动cachecloud-master到/usr/local目录

tar -xvf cachecloud-master.zip

修改redis版本:
四十四、Redis云平台CacheCloud搭建之源码部署_第1张图片

四十四、Redis云平台CacheCloud搭建之源码部署_第2张图片

编辑配置文件:

vim  /usr/local/cachecloud-master/cachecloud-open-web/src/main/swap/online.properties

vim  /usr/local/cachecloud-master/cachecloud-open-web/src/main/swap/local.properties
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

执行cachecloud-init.sh脚本,安装redis服务器:
这个脚本干两件事:

  • 安装redis服务器
  • 生成ssh账号(如下图用到)
    四十四、Redis云平台CacheCloud搭建之源码部署_第3张图片
sh /usr/local/cachecloud-master/script/cachecloud-init.sh admin

admin声明创建的文件都在linux下admin用户所属

redis服务端默认安装路径:/opt/cachecloud/redis

结果:

Hint: It's a good idea to run 'make test' ;)

make[1]: Leaving directory `/opt/cachecloud/redis/src'
cd src && make install
make[1]: Entering directory `/opt/cachecloud/redis/src'
    CC Makefile.dep
make[1]: Leaving directory `/opt/cachecloud/redis/src'
make[1]: Entering directory `/opt/cachecloud/redis/src'

Hint: It's a good idea to run 'make test' ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
make[1]: Leaving directory `/opt/cachecloud/redis/src'
OK: redis is installed, exit.

在cachecloud-master目录下执行编译、安装命令:

压缩包解压后目录:/usr/local/cachecloud-master

[root@redis cachecloud-master]# mvn clean compile install -Ponline

结果如下:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] cachecloud-open-parent ............................. SUCCESS [  0.390 s]
[INFO] cachecloud-open-client ............................. SUCCESS [  0.017 s]
[INFO] cachecloud-open-client-basic ....................... SUCCESS [  3.037 s]
[INFO] cachecloud-jedis ................................... SUCCESS [  4.778 s]
[INFO] cachecloud-open-common ............................. SUCCESS [  0.211 s]
[INFO] cachecloud-open-web ................................ SUCCESS [  9.570 s]
[INFO] cachecloud-open-client-redis ....................... SUCCESS [  0.942 s]
[INFO] cachecloud-open-jedis-stat ......................... SUCCESS [  0.294 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.465 s
[INFO] Finished at: 2018-09-08T22:29:50+08:00
[INFO] Final Memory: 42M/239M
[INFO] -----------------------------------------------------------------------

创建/opt/cachecloud-web目录,并拷贝相关文件:

mkdir -p /opt/cachecloud-web

cp  cachecloud-open-web/target/cachecloud-open-web-1.0-SNAPSHOT.war /opt/cachecloud-web/

cp  cachecloud-open-web/src/main/resources/cachecloud-web.conf /opt/cachecloud-web/cachecloud-open-web-1.0-SNAPSHOT.conf

ln -s /opt/cachecloud-web/cachecloud-open-web-1.0-SNAPSHOT.war  /etc/init.d/cachecloudweb

3、CacheCloud云平台启动

启动CacheCloud云平台:


[root@redis cachecloud-master]# /etc/init.d/cachecloudweb start
which: no start-stop-daemon in (/usr/local/rvm/gems/ruby-2.4.4/bin:/usr/local/rvm/gems/ruby-2.4.4@global/bin:/usr/local/rvm/rubies/ruby-2.4.4/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/rvm/bin:/opt/module/jdk1.8.0_161/bin:/root/bin:/opt/module/jdk1.8.0_161/bin:/usr/local/maven/apache-maven-3.2.5/bin:/opt/module/jdk1.8.0_161/bin:/usr/local/maven/apache-maven-3.2.5/bin)
Started [15022]

关闭CacheCloud云平台:

[root@redis cachecloud-master]# /etc/init.d/cachecloudweb stop

4、启动方式二

[root@data3 cachecloud-master]# cp script/start.sh /opt/cachecloud-web
[root@data3 cachecloud-master]# cp script/stop.sh /opt/cachecloud-web

sh start.sh
sh stop.sh

5、登录

用户名:admin
密码:admin

登录地址:http://192.168.1.108:8585/manage/login

四十四、Redis云平台CacheCloud搭建之源码部署_第4张图片

你可能感兴趣的:(Redis,CacheCloudy,从零开始学Redis)