后臺服務(wù)基本軟件包(java/mysql/mycat/zookeeper/redis/nginx)安裝與配置

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服務(wù)
systemctl start mysqld

#設(shè)置開機啟動
systemctl enable mysqld
systemctl daemon-reload
 
#不能登錄時設(shè)置自定義密碼
#先找到原始密碼,然后登錄設(shè)置自定義密碼
grep 'temporary password' /var/log/mysqld.log
set password for 'root'@'localhost'=password('1234'); 
 
#設(shè)置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相關(guān)文件配置看自己 MYCAT官網(wǎng)鏈接

REDIS(主備機+哨兵模式)

下載 (版本自己選擇對應(yīng)地址)
wget http://download.redis.io/releases/redis-4.0.11.tar.gz
操作
#安裝,提示缺少什么包就直接安裝什么包類似(yum install gcc)
make MALLOC=libc
make install

vim redis.conf
#主機器修改內(nèi)容如下:
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

#在備機器上重復(fù)上述操作
#在備機器上添加主:
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
#啟動監(jiān)聽
./src/redis-sentinel ./sentinel.conf
驗證
Redis服務(wù)開啟

互為主備

互為主備

ZOOKEEPER

下載 (版本自己選擇對應(yīng)地址)
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
操作
vi /etc/profile
#結(jié)尾處添加
#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

# 啟動/停止/查看狀態(tài)
./bin/zkServer.sh start(stop/restart/status)
驗證
zookeeper啟動

NGINX

下載 (版本自己選擇對應(yīng)地址)
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首頁訪問

====================完畢===============================
====================有問題請留言=========================

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容