个人名片:

对人间的热爱与歌颂,可抵岁月冗长

Github‍:念舒_C.ying

CSDN主页️:念舒_C.ying

个人博客 :念舒_C.ying

1 修改主机名:

[root@localhost ~]# hostnamectl set-hostname mall

2 修改/etc/hosts配置文件:

[root@mall ~]# vi /etc/hosts
192.168.100.10 mall

3 配置本地yum源:

将gpmall-repo上传到服务器的/opt目录下,并配置本地local.repo文件

mkdir -p /opt/centos
mount /dev/cdrom /opt/centos
[root@mall ~]# vi /etc/yum.repos.d/local.repo
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[mall]
name=mall
baseurl=file:///opt/gpmall-repo
gpgcheck=0
enabled=1

4 安装基础服务:

4.1 安装java环境:

[root@mall ~]# yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel
[root@mall ~]# java -version

4.2 安装Redis缓存服务:

[root@mall ~]# yum install redis -y

4.3 安装Elasticsearch服务:

[root@mall ~]# yum install elasticsearch -y

4.4 安装Nginx服务:

[root@mall ~]# yum install nginx -y

4. 5 安装Mariadb服务:

[root@mall ~]# yum install mariadb mariadb-server -y

4.6 安装zookeeper服务:

将zookeeper-3.4.14.tar.gz上传至云主机的/opt内,解压压缩包命令如下:

[root@mall ~]# tar -zxvf zookeeper-3.4.14.tar.gz

进入到zookeeper-3.4.14/conf目录下,将zoo_sample.cfg文件重命名为zoo.cfg,命令如下:

[root@mall conf]# mv zoo_sample.cfg zoo.cfg

进入到zookeeper-3.4.14/bin目录下,启动ZooKeeper服务,命令如下:

 ./zkServer.sh start

查看ZooKeeper状态,命令如下:

./zkServer.sh status

4.7 安装kafka服务:

将提供的kafka_2.11-1.1.1.tgz包上传到云主机的/opt目录下,解压该压缩包,命令如下:

tar -zxvf kafka_2.11-1.1.1.tgz

进入到kafka_2.11-1.1.1/bin目录下,启动Kafka服务,命令如下:

使用jps命令查看Kafka是否成功启动,命令如下:

[root@mall bin]# jps
6039 Kafka
1722 QuorumPeerMain
6126 Jps

5 启动服务

5.1 启动数据库并配置

修改数据库配置文件并启动Mariadb数据库,设置root用户密码为123456,并创建gpmall数据库,将提供的gpmall.sql导入。

修改/etc/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

启动数据库

[root@mall ~]# systemctl start mariadb

5.2 初始化数据库

设置root用户的密码为123456并登录

[root@mall ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): #默认按回车
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password: #输入数据库root密码123456
Re-enter new password: #重复输入密码123456
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
... skipping.
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[root@mall ~]# mysql -uroot –p123456

设置root用户的权限,命令如下:

MariaDB [(none)]> grant all privileges on *.* to root@localhost identified by '123456' with grant option;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> grant all privileges on *.* to root@"%" identified by '123456' with grant option;
Query OK, 0 rows affected (0.001 sec)

将gpmall.sql文件上传至云主机的/root目录下。创建数据库gpmall并导入gpmall.sql文件

MariaDB [(none)]> create database gpmall;
MariaDB [(none)]> use gpmall;
MariaDB [mall]> source /root/gpmall.sql

退出数据库并设置开机自启

MariaDB [mall]> exit;
[root@mall ~]# systemctl enable mariadb

5.3 启动Redis服务

修改Redis配置文件,编辑/etc/redis.conf文件。

将bind 127.0.0.1这一行注释掉:

将protected-mode yes 改为protect-mode no。

启动Redis服务命令如下:

[root@mall ~]# systemctl start redis
[root@mall ~]# systemctl enable redis

配置Elasticsearch服务并启动

[root@mall ~]# vi /etc/elasticsearch/elasticsearch.yml

在文件最上面加入3条语句如下:

http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-credentials: true

将如下4条语句前的注释符去掉,并修改network.host的IP为本机IP

cluster.name: my-application
node.name: node-1
network.host: 192.168.94.1
http.port: 9200

最后修改完之后保存退出。然后启动Elasticsearch并设置开机自启,命令如下

[root@mall ~]# systemctl start elasticsearch
[root@mall ~]# systemctl enable elasticsearch

5.4 启动Nginx服务

[root@mall ~]# systemctl start nginx
[root@mall ~]# systemctl enable nginx

6. 全局变量配置

修改/etc/hosts文件

[root@mall ~]# vi /etc/hosts
192.168.100.10 kafka.mall
192.168.100.10 mysql.mall
192.168.100.10 redis.mall
192.168.100.10 zookeeper.mall

7. 部署前端

将dist目录上传至服务器的/root目录下。接着dist目录下的文件,复制到Nginx默认项目路径(首先清空默认路径下的文件)

[root@mall ~]# rm -rf /usr/share/nginx/html/*
[root@mall ~]# cp -rvf dist/* /usr/share/nginx/html/

修改Nginx配置文件/etc/nginx/conf.d/default.conf,添加映射如下所示

[root@mall ~]# vi /etc/nginx/conf.d/default.conf
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 404 /404.html;

重启Nginx服务,命令如下:

[root@mall ~]# systemctl restart nginx

8 部署后端

将提供的4个jar包上传到服务器的/root目录下,并启动,启动命令如下

[root@mall gpmall]# nohup java -jar shopping-provider-0.0.1-SNAPSHOT.jar &
按回车
[1] 6432
[root@mall gpmall]# nohup: ignoring input and appending output to ‘nohup.out’
按回车
[root@mall gpmall]# nohup java -jar user-provider-0.0.1-SNAPSHOT.jar &
[2] 6475
[root@mall gpmall]# nohup: ignoring input and appending output to ‘nohup.out’
按回车
[root@mall gpmall]# nohup java -jar gpmall-shopping-0.0.1-SNAPSHOT.jar &
[3] 6523
[root@mall gpmall]# nohup: ignoring input and appending output to ‘nohup.out’
按回车
[root@mall gpmall]# nohup java -jar gpmall-user-0.0.1-SNAPSHOT.jar &
[4] 6563
[root@mall gpmall]# nohup: ignoring input and appending output to ‘nohup.out’
按回车

按照顺序运行4个jar包之后,后端部署完成。

9. 网站访问

打开浏览器,在地址栏输入http://192.168.100.10,访问界面。

单节点部署 gpmall 商城的更多相关文章

  1. Ubuntu下用devstack单节点部署Openstack

    一.实验环境 本实验是在Vmware Workstation下创建的单台Ubuntu服务器版系统中,利用devstack部署的Openstack Pike版. 宿主机:win10 1803  8G内存 ...

  2. HyperLedger Fabric 1.4 单机单节点部署(10.2)

    单机单节点指在一台电脑上部署一个排序(Orderer)服务.一个组织(Org1),一个节点(Peer,属于Org1),然后运行官方案例中的example02智能合约例子,实现转财交易和查询功能.单机单 ...

  3. .netcore consul实现服务注册与发现-单节点部署

    原文:.netcore consul实现服务注册与发现-单节点部署 一.Consul的基础介绍     Consul是HashiCorp公司推出的开源工具,用于实现分布式系统的服务发现与配置.与其他分 ...

  4. Kubernetes 二进制部署(一)单节点部署(Master 与 Node 同一机器)

    0. 前言 最近受“新冠肺炎”疫情影响,在家等着,入职暂时延后,在家里办公和学习 尝试通过源码编译二进制的方式在单一节点(Master 与 Node 部署在同一个机器上)上部署一个 k8s 环境,整理 ...

  5. 恒天云单节点部署指南--OpenStack H版本虚拟机单节点部署解决方案

    本帖是openstack单节点在虚拟机上部署的实践.想要玩玩和学习openstack的小伙伴都看过来,尤其是那些部署openstack失败的小伙伴.本帖可以让你先领略一下openstack的魅力.本I ...

  6. Presto0.157版本单节点部署教程

    因为Presto版本的更新速度较快,所以最好按照对应版本的教程进行部署,博主之前看错了版本号,拿0.100版本的教程来部署0.157版本,结果导致部署失败. 官网:https://prestodb.i ...

  7. MongoDB 3.2复制集单节点部署(四)

    MongoDB在单节点中也可以做复制集,但是仅限于测试实验,最大的好处就是部署方便快速,可以随便添加新节点,节省资源.在这里我使用的是MongoDB 3.2版本进行复制集实验(但MongoDB配置文件 ...

  8. MongoDB 2.6复制集单节点部署(三)

    MongoDB在单节点中也可以做复制集,但是仅限于测试实验,最大的好处就是部署方便快速,可以随便添加新节点,节省资源.在这里我使用的是MongoDB 2.6版本进行复制集实验(但MongoDB配置文件 ...

  9. 单节点部署Hadoop教程

    搭建HDFS 增加主机名 我这里仅仅增加了master主机名 [root@10 /xinghl/hadoop/bin]$ cat /etc/hosts 127.0.0.1 localhost 10.0 ...

  10. PinPoint单节点部署及客户端配置方法

    在一次做项目中,需要涉及全链路压测,为了更好定位链路中某一节点可能会出现的问题,在繁忙之余,快速部署及应用了该链路工具,分享给大家~ 话不多说,开始部署~ 一.环境配置1.1 获取需要的依赖包进入ho ...

随机推荐

  1. 如何将原生微信小程序页面改成原生VUE框架的H5页面

    项目背景: 公司为了实现小程序与H5页面共同覆盖,全面推广.特此想将已有的小程序进行快速改造上线(二周内),研发出H5版本.目前公司前端技术较为薄弱,现有的技术解决方案还停留在JSP. 问题: 如何将 ...

  2. KingbaseES V8R6C5B041手工创建集群测试案例

    ​ 案例说明: KingbaseES V8R6C5B041版本和以前的KingbaseES R6有一定的区别,增加了"securecmdd"的工具,并且在install.conf配 ...

  3. int和String的相互转化

    int和String的相互转化 将int转化为String 通过valueof( )方法进行转化 int a=100;String num1=String.valueOf(a);        Sys ...

  4. centos7.9使用yum方式安装MongoDB 5.x

    1.配置阿里云yum仓库 #vim /etc/yum.repos.d/mongodb-org-5.0.repo [mngodb-org] name=MongoDB Repository baseurl ...

  5. 企业信息化建PLM系统、ERP系统、MES系统是单个逐步建设好,还是同时上比较好?

    企业信息化建PLM系统.ERP系统.MES系统肯定是单个逐步建设好啊,不仅仅是各个系统单独建设,系统内各模块的实施也应该先后逐步推进,切不可想着一口吃个大胖子,一股脑的全上,求全求快是很多系统实施失败 ...

  6. 为什么中国的To B企业都活的很“惨”?

    说[中国的To B企业都活的很"惨"]容易引起误解,提问者的To B企业本意应该是软件服务,尤其是指CRM.ERP等强个性化需求的企业管理类软件服务,现阶段更侧重于数字化转型市场中 ...

  7. 关于private子网访问s3时报错:Connect timeout on endpoint URL

    今天在使用private私有子网,通过aws s3命令访问s3时,报如下错误: [qq_5201351@private ~]$ aws s3 ls Connect timeout on endpoin ...

  8. 洛谷P1725 琪露诺 (单调队列/堆优化DP)

    显然的DP题..... 对于位置i,它由i-r~i-l的位置转移过来,容易得到方程 dp[i]=dp[i]+max(dp[i−r],...,dp[i−l]). 第一种:n2的暴力,只能拿部分分. 1 ...

  9. 为什么ArrayList的subList结果不能转换为ArrayList????

    subList是List接口中的一个方法,该方法主要返回一个集合中的一段子集,可以理解为截取一个集合中的部分元素,它的返回值也是一个List. 让我们初始化一个例子: import java.util ...

  10. struts2 标签总结

    <s:if>判断字符串的问题: 1.判断单个字符:<s:if test="#session.user.username=='c'"> 这样是从session ...