2三、生鮮電商平臺-服務器部署設計與架構

補充說明:Java開源生鮮電商平臺-服務器部署設計與架構,指的是經過服務器正式上線整個項目,進行正式的運營。html

              

回顧整個章節,咱們涉及到如下幾個方面:nginx

1. 買家端web

2. 賣家端。數據庫

3. 銷售端tomcat

4. 配送端。服務器

5.系統運營端。架構

6.公司網址併發

 

目前根據業務的狀況,採購了阿里雲服務器,因爲是創業,我身上沒多少錢,只採購了一臺阿里雲.(具體配置以下與域名規劃以下)負載均衡

 

公司網址: http://www.netcai.com高併發

買家端:  http://buyer.netcai.com

賣家端:  http://seller.netcai.com

配送端:http://delivery.netcai.com

銷售端:http://sales.netcai.com

後臺端:http://admin.netcai.com

 

 具體費用以下:

 

 說明:域名採用二級域名進行轉發與配置。

           服務器採用nginx進行根據域名轉發。相關的配置我就貼在下面

           若是須要進行業務的處理,好比說,咱們發現買家的人數在增長,負載不夠,咱們能夠把買家的域名綁定在一臺新的服務器上面進行

           最終也能夠實現負載均衡的。

        

          實現的基礎業務邏輯以下:

          域名---》nginx-->tomcat7

 

         nginx的核心配置以下:

     

複製代碼
#admin port 8080
server
 {
        server_name admin.netcai.com;
        index index.html index.htm;
    access_log  /webser/nginx/tomcat-admin/access/log/access.log  access;
    location / {
                 proxy_pass        http://localhost:8080;
                 proxy_set_header   Host         $host;
                 proxy_set_header   X-Real-IP        $remote_addr;
                 proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
}

#buyer port 8081
server 
 {
        server_name buyer.netcai.com;
        index index.html index.htm;
    access_log  /webser/nginx/tomcat-buyer/access/log/access.log  access;
    location / {
                 proxy_pass        http://localhost:8081;
                 proxy_set_header   Host         $host;
                 proxy_set_header   X-Real-IP        $remote_addr;
                 proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
}

#seller port 8082
server
 {
        server_name seller.netcai.com;
        index index.html index.htm;
    access_log  /webser/nginx/tomcat-seller/access/log/access.log  access;
    location / {
                 proxy_pass        http://localhost:8082;
                 proxy_set_header   Host         $host;
                 proxy_set_header   X-Real-IP        $remote_addr;
                 proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
}

#delivery port 8083
server
 {
        server_name delivery.netcai.com;
        index index.html index.htm;
    access_log  /webser/nginx/tomcat-delivery/access/log/access.log  access;
    location / {
                 proxy_pass        http://localhost:8083;
                 proxy_set_header   Host         $host;
                 proxy_set_header   X-Real-IP        $remote_addr;
                 proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
}

#sales port 8085
server
 {
        server_name sales.netcai.com;
        index index.html index.htm;
    access_log  /webser/nginx/tomcat-sales/access/log/access.log  access;
    location / {
                 proxy_pass        http://localhost:8085;
                 proxy_set_header   Host         $host;
                 proxy_set_header   X-Real-IP        $remote_addr;
                 proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
}

#purchase port 8088
server
 {
        server_name purchase.netcai.com;
        index index.html index.htm;
    access_log  /webser/nginx/tomcat-purchase/access/log/access.log  access;
    location / {
                 proxy_pass        http://localhost:8088;
                 proxy_set_header   Host         $host;
                 proxy_set_header   X-Real-IP        $remote_addr;
                 proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
}

#tongmei port 7070
server
 {
        server_name tongmei.netcai.com;
        index index.html index.htm;
    access_log  /webser/nginx/tomcat-tongmei/access/log/access.log  access;
    location / {
                 proxy_pass        http://localhost:7070;
                 proxy_set_header   Host         $host;
                 proxy_set_header   X-Real-IP        $remote_addr;
                 proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
}


#users port 7080
server
 {
        server_name users.netcai.com;
        index index.html index.htm;
    access_log  /webser/nginx/tomcat-users/access/log/access.log  access;
    location / {
                 proxy_pass        http://localhost:7080;
                 proxy_set_header   Host         $host;
                 proxy_set_header   X-Real-IP        $remote_addr;
                 proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
}

#monitor port 19999
server
 {
        server_name monitor.netcai.com;
        index index.html index.htm;
    access_log  /webser/nginx/monitor/access/log/access.log  access;
    location / {
                 proxy_pass        http://localhost:19999;
                 proxy_set_header   Host         $host;
                 proxy_set_header   X-Real-IP        $remote_addr;
                 proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
}
複製代碼

 

  Nginx的配置相對而言比較簡單,根據域名找對應的tomcat服務器便可,而後記錄相關的訪問日誌與路徑便可。

 

tomcat7的配置,那就更加的容易與簡單了。

相關的配置,你們去修改下server.xml,配置不一樣的端口便可。

最終造成如下的截圖:

 

 對此,有人認爲這樣作,若是服務器掛了,整個服務器的應用都癱瘓了,我想說的是由於錢很少,只能這樣搞

至於高可用,高負載,高併發等等架構,若是有錢了,能夠根據域名進行負載

文件服務器一臺

數據庫服務器一臺

都是能夠的,重點不是考慮成本,而是沒有多少成本,須要節約。請各位創業的人明白其中的道理。

 

最終,公司網址,就直接指向一個靜態的地址便可,而後直接用nginx跑

 

整個負載狀況,咱們能夠用top查看,也能夠用monitor監控,都是能夠的。

 

記住:我這裏面都是實戰,實戰,實戰,如今還在運行在,域名沒公開,是個隨便寫的域名

 

 

轉載自-- https://www.cnblogs.com/jurendage/p/9103339.html

相關文章
相關標籤/搜索