后台服务基本软件包(java/mysql/mycat/zooke
2019-09-29 本文已影响0人
TTTTTriM
JAVA
下载 https://www.oracle.com/technetwork/java/javase/downloads/index.html
操作
tar -zxvf jdk-8u201.tar.gz
vi /etc/profile
#尾部添加并保存
#java
export JAVA_HOME=/usr/local/jdk1.8.0_201
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib
source /etc/profile
验证 java -version.png
MYSQL
下载
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
操作
yum localinstall mysql57-community-release-el7-8.noarch.rpm
yum install mysql-community-server
#启动mysql服务
systemctl start mysqld
#设置开机启动
systemctl enable mysqld
systemctl daemon-reload
#不能登录时设置自定义密码
#先找到原始密码,然后登录设置自定义密码
grep 'temporary password' /var/log/mysqld.log
set password for 'root'@'localhost'=password('1234');
#设置MYSQL默认字符集
/etc/my.cnf
character_set_server=utf8
init_connect='SET NAMES utf8'
配置MYCAT
wget http://dl.mycat.io/1.6-RELEASE/Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz
tar -zxvf Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz
schema.xml / rule.xml ... mycat相关文件配置看自己 MYCAT官网链接
REDIS(主备机+哨兵模式)
下载 (版本自己选择对应地址)
wget http://download.redis.io/releases/redis-4.0.11.tar.gz
操作
#安装,提示缺少什么包就直接安装什么包类似(yum install gcc)
make MALLOC=libc
make install
vim redis.conf
#主机器修改内容如下:
bind 127.0.0.1 #这一行注释掉
protected-mode yes #改为protected-mode no
daemonize no #改为daemonize yes
logfile "" #改为logfile"/var/log/redis.log"
masterauth xxxxx
requirepass xxxxx
#在备机器上重复上述操作
#在备机器上添加主:
slaveof x.x.x.x<主机器IP> 6379
#在主机器上
vi sentinel.conf
sentinel known-slave mymaster xxx.xxx.xxx.xxx<备机IP> 6379
sentinel current-epoch 2
logfile "/var/log/sentinel.log"
daemonize yes
sentinel monitor mymaster xxx.xxx.xxx.xxx<主机IP> 6379 1
sentinel auth-pass mymaster xxxx
#启动2个redis
./src/redis-server ./redis.conf
#启动监听
./src/redis-sentinel ./sentinel.conf
验证
Redis服务开启互为主备
互为主备
ZOOKEEPER
下载 (版本自己选择对应地址)
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
操作
vi /etc/profile
#结尾处添加
#zk
export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.14/
export PATH=$ZOOKEEPER_HOME/bin:$PATH
export PATH
vi zoo.cfg
dataDir=/usr/local/zookeeper/zookeeper-3.4.10/data
dataLogDir=/usr/local/zookeeper/zookeeper-3.4.10/logs
# 启动/停止/查看状态
./bin/zkServer.sh start(stop/restart/status)
验证
zookeeper启动NGINX
下载 (版本自己选择对应地址)
wget -c https://nginx.org/download/nginx-1.10.2.tar.gz
操作
#安装4个组件
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
tar -zxvf nginx-1.10.2.tar.gz
cd nginx-1.10.2
#配置安装4大模块
./configure --user=nobody --group=nobody --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module
make && make install
#配置生成的nginx.conf
cd /usr/local/nginx
vi conf/nginx.conf
#NGINX启动、重启、停止
./sbin/nginx -t
./sbin/nginx
(./sbin/nginx -s reload
./sbin/nginx -s stop)
验证
NGINX首页访问====================完毕===============================
====================有问题请留言=========================