llamgp
1 修改主机名
hostnamectl set-hostname server
2 修改hosts文件
vi /etc/hosts
192.168.200.3 server
3 配置yum源
gpmall-repo
4 安装java环境
yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel
#查看java版本
java -version
5 安装redis、nginx、数据库
yum install redis -y
yum install nginx -y
yum install mariadb mariadb-server -y
6 安装zookeeper
#解压zookeeper的压缩包
#进入Zookeeper的配置文件目录
cd zookeeper-3.4.14/conf
#将原来的模板配置文件改名
mv zoo_sample.cfg zoo.cfg
#进到Zookeeper的bin目录
cd ../bin
#启动Zookeeper服务
./zkServer.sh start
7 安装kafka
#解压kafka的压缩包
#进入到kafka的bin目录
cd kafka_2.11-1.1.1/bin
#启动kafka服务
./kafka-server-start.sh -daemon ../config/server.properties
8 配置mariadb数据库并启动
vi /etc/my.cnf
在数据库的my.cnf文件添加内容如下
[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
#启动数据库
systemctl start mariadb
#设置数据库root的密码为123456
mysqladmin -uroot password 123456
#创建gpmall数据库,并将gpmall.sql文件导入
mysql -uroot -p123456
create database gpmall;
use gpmall;
source /root/gpmall.sql;
#设置开机自启数据库
systemctl enable mariadb
#重启数据库服务
systemctl restart mariadb
9 配置redis服务并启动
#修改redis的配置文件,将bind 127.0.0.1注释
sed -i 's/bind 127.0.0.1/#bind 127.0.0.1/g' /etc/redis.conf
#修改redis的配置文件,将protected-mode yes改为protected-mode no
sed -i 's/protected-mode yes/protected-mode no/g' /etc/redis.conf
#启动redis服务
systemctl start redis
#设置开机自启
systemctl enable redis
10 配置nginx并启动
#删除默认项目路径下的文件
rm -rf /usr/share/nginx/html/*
#将提供的dist静态文件复制到nginx项目目录
cp -rvf /root/dist/* /usr/share/nginx/html
vi /etc/nginx/conf.d/default.conf
#修改nginx配置文件如下
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /user {
proxy_pass http://127.0.0.1:8082;
}
location /shopping {
proxy_pass http://127.0.0.1:8081;
}
location /cashier {
proxy_pass http://127.0.0.1:8083;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
#启动nginx服务
systemctl start nginx
#设置nginx开机自启
systemctl enable nginx
11 start_jar
vi /etc/hosts
$HOSTIP kafka.mall //填自己的IP
127.0.0.1 mysql.mall
$HOSTIP redis.mall //填自己的IP
$HOSTIP zookeeper.mall //填自己的IP
#赋予root用户本地和远程的权限
mysql -uroot -p123456
grant all privileges on *.* to root@localhost identified by '123456' with grant option;
grant all privileges on *.* to root@"%" identified by '123456' with grant option;
flush privileges;
#重启数据库
systemctl restart mariadb
#在后台运行jar包,先运行两个provider的jar包,后运行两个gpmall的jar包
nohup java -jar shopping-provider-0.0.1-SNAPSHOT.jar &
nohup java -jar user-provider-0.0.1-SNAPSHOT.jar &
nohup java -jar gpmall-shopping-0.0.1-SNAPSHOT.jar &
nohup java -jar gpmall-user-0.0.1-SNAPSHOT.jar &
systemctl restart nginx
12 在浏览器访问您的IP
- 点赞
- 收藏
- 关注作者
评论(0)