国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

1+X 云計算運維與開發(fā)(中級)案例實戰(zhàn)——單節(jié)點應(yīng)用商城系統(tǒng)部署

這篇具有很好參考價值的文章主要介紹了1+X 云計算運維與開發(fā)(中級)案例實戰(zhàn)——單節(jié)點應(yīng)用商城系統(tǒng)部署。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。


前言

學(xué)而不思則罔,思而不學(xué)則殆。


1.思路

整個系統(tǒng)的部署說白了就是安裝各種服務(wù),然后修改配置文件,最后啟動。
主機名!主機名!主機名!(重要的事說三遍)

1.修改主機名,修改 /etc/hosts 文件。
2.使用 gpmall-repo 文件和 CentOS-7-x86_64-DVD-1511.iso 文件來配置 yum源
3.使用yum來安裝各個服務(wù)。
4.將 zookeeper-3.4.14.tar.gzkafka_2.11-1.1.1.tgz上傳,解壓,然后分別配置啟動
5.配置并啟動各個服務(wù)。
6.上傳4個 .jar 文件,并且按順序啟動

2.實操

1.修改主機名,修改 /etc/hosts 文件

代碼如下(示例):

[root@mall ~]# hostnamctl set-hostname mall
[root@mall ~]# logout					--使主機名生效
[root@mall ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
## 以下為新增內(nèi)容
192.168.200.11 mall     				--這一行將決定你的kafka進程是否會正常運行
192.168.200.11 kafka.mall
192.168.200.11 mysql.mall
192.168.200.11 redis.mall
192.168.200.11 zookeeper.mall

說明:這里的主機名( hostnamctl set-hostname mall),我嘗試過其他名稱,然后在 /etc/hosts 文件中輸入相對應(yīng)的映射,但是會導(dǎo)致后期實驗完成后,打開網(wǎng)頁時白屏,我猜測和后面的 jar 包的內(nèi)容有關(guān),但是本人功力有限,所以只能中規(guī)中矩使用 mall

2.配置yum源

代碼如下(示例):

[root@mall ~]# rm -rf /etc/yum.repos.d/*   								       	這一行的作用是刪除原有的repo文件對后續(xù)的影響
[root@mall ~]# cat /etc/yum.repos.d/local.repo 
[gpmall]
name=gpmall
baseurl=file:///root/gpmall-repo															這里的gpmall-repo文件需要自己上傳
gpgcheck=0
enabled=1
[centos]
name=centos
baseurl=file:///opt/cdrom																		 這里的/opt/cdrom需要自己創(chuàng)建
gpgcheck=0
enabled=1
[root@mall ~]# mkdir /opt/cdrom
[root@mall ~]# mount CentOS-7-x86_64-DVD-1511.iso /opt/cdrom
mount: /dev/loop0 is write-protected, mounting read-only
[root@mall ~]# yum repolist
Loaded plugins: fastestmirror
centos                                                   | 3.6 kB     00:00     
gpmall                                                   | 2.9 kB     00:00     
(1/3): centos/group_gz                                     | 155 kB   00:00     
(2/3): gpmall/primary_db                                   | 144 kB   00:00     
(3/3): centos/primary_db                                   | 2.8 MB   00:00     
Determining fastest mirrors
repo id                              repo name                            status
centos                               centos                               3,723
gpmall                               gpmall                                 165
repolist: 3,888

3.使用yum來安裝各個服務(wù)(java, mysql, nginx, redis)

代碼如下(示例):

[root@mall ~]# yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
...
[root@mall ~]# java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
[root@mall ~]# yum -y install mariadb mariadb-server
[root@mall ~]# yum -y install nginx
[root@mall ~]# yum -y install redis

4.將 zookeeper-3.4.14.tar.gz 和 kafka_2.11-1.1.1.tgz 解壓并啟動

代碼如下(示例):

[root@mall ~]# tar -zxvf zookeeper-3.4.14.tar.gz
[root@mall ~]# cd zookeeper-3.4.14/conf/
[root@mall conf]# mv zoo_sample.cfg zoo.cfg			##重命名
[root@mall conf]# cd ../bin
[root@mall bin]# pwd
/root/zookeeper-3.4.14/bin
[root@mall bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /root/zookeeper-3.4.14/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@mall bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /root/zookeeper-3.4.14/bin/../conf/zoo.cfg
Mode: standalone
[root@mall ~]# tar -zxvf kafka_2.11-1.1.1.tgz
[root@mall ~]# cd kafka_2.11-1.1.1/bin/
[root@mall bin]# ./kafka-server-start.sh -daemon ../config/server.properties 
[root@mall bin]# jps
3204 QuorumPeerMain
3515 Kafka
3579 Jps

說明:一定要確認(rèn)kafka進程正常運行

5.配置并啟動各個服務(wù)(java, mysql, nginx, redis)

代碼如下(示例):

5.1 配置mysql

[root@mall ~]# systemctl start mariadb
[root@mall ~]# mysql_secure_installation

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: #密碼務(wù)必使用123456
Re-enter new password: 
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.

[root@mall ~]# mysql -uroot -p123456
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 10.3.18-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

-------------------------------------------------------------------------------------------------------------------------

MariaDB [(none)]> create database gpmall;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> use gpmall;
Database changed
MariaDB [gpmall]> grant all privileges on *.* to root@localhost identified by '123456' with grant option;
Query OK, 0 rows affected (0.000 sec)

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

MariaDB [gpmall]> flush privileges;
Query OK, 0 rows affected (0.000 sec)

MariaDB [gpmall]> source /root/gpmall-single/gpmall.sql            ##這個gpmall.sql需要自己上傳
Query OK, 0 rows affected (0.000 sec)
...
Query OK, 0 rows affected (0.000 sec)

MariaDB [gpmall]> Bye

[root@mall ~]# systemctl enable mariadb

5.2 配置redis

修改/etc/redis.conf文件
1.第61行用#注釋掉

#bind 127.0.0.1

2.第80行把yes改為no

protected-mode no

[root@mall bin]# systemctl start redis && systemctl enable redis
Created symlink from /etc/systemd/system/multi-user.target.wants/redis.service to
/usr/lib/systemd/system/redis.service.

5.3 配置nginx

代碼如下(示例):

[root@mall ~]# vi /etc/nginx/conf.d/default.conf
	在error_page上一行開始編輯,添加以下內(nèi)容:
	
    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;
                }
---------------------------------------------------------------------------------------------------------------------
[root@mall ~]# rm -rf /usr/share/nginx/html/*
[root@mall ~]# cp -R gpmall-single/dist/* /usr/share/nginx/html/
[root@mall ~]# systemctl start nginx && systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.

6.上傳4個 .jar 文件,并且按順序啟動

代碼如下(示例):

[root@mall gpmall-single]# nohup java -jar shopping-provider-0.0.1-SNAPSHOT.jar &
[1] 6825
[root@mall gpmall-single]# nohup: ignoring input and appending output to ‘nohup.out’

[root@mall gpmall-single]# nohup java -jar user-provider-0.0.1-SNAPSHOT.jar &
[2] 6866
[root@mall gpmall-single]# nohup: ignoring input and appending output to ‘nohup.out’

[root@mall gpmall-single]# nohup java -jar gpmall-shopping-0.0.1-SNAPSHOT.jar &
[3] 6912
[root@mall gpmall-single]# nohup: ignoring input and appending output to ‘nohup.out’

[root@mall gpmall-single]# nohup java -jar gpmall-user-0.0.1-SNAPSHOT.jar &
[4] 6951
[root@mall gpmall-single]# nohup: ignoring input and appending output to ‘nohup.out’

[root@mall gpmall-single]# systemctl stop firewalld
s[root@mall gpmall-single]# setenforce 0

說明:每輸入一遍 nohup命令之后,它會自動彈出一個提示,所以一共輸入了 四次nohup,如果輸入的結(jié)果 不正常(正不正??碵1]這樣的提示,一般來講[1],[2],[3],[4]),請 kill進程然后排錯后重新按照順序啟動,最后,請 關(guān)閉防火墻

總結(jié)

1+X 云計算運維與開發(fā)(中級)案例實戰(zhàn)——單節(jié)點應(yīng)用商城系統(tǒng)部署

多讀書,多看報,少吃零食,好好睡覺。
努力就完啦!??!文章來源地址http://www.zghlxwxcb.cn/news/detail-428883.html

到了這里,關(guān)于1+X 云計算運維與開發(fā)(中級)案例實戰(zhàn)——單節(jié)點應(yīng)用商城系統(tǒng)部署的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包