欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

永中文檔在線轉(zhuǎn)換預(yù)覽基于nginx配置部署方案

 更新時間:2022年06月09日 11:09:22   作者:yozodcs  
這篇文章主要為大家介紹了永中文檔在線轉(zhuǎn)換預(yù)覽基于nginx配置部署方案的實現(xiàn),有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

永中文檔在線轉(zhuǎn)換預(yù)覽雙活實現(xiàn)方案

永中文檔在線轉(zhuǎn)換預(yù)覽服務(wù) 是永中軟件股份有限公司基于十多年核心技術(shù)積累、面向移動互聯(lián)領(lǐng)域推出的 一款文檔處理軟件。永中采用自主可控核心技術(shù),具備快速技術(shù)和服務(wù)響應(yīng)能力,把文檔原樣輸出為 HTML,圖片等,即點即得、無需下載、保護(hù)文檔隱私,快速高效,輕松實現(xiàn)文檔在線安全閱讀。?

實現(xiàn)目標(biāo)

  • 通過nginx實現(xiàn)業(yè)務(wù)fcsserver負(fù)載均衡,后端可以動態(tài)擴(kuò)展應(yīng)用服務(wù)器
  • nginx通過keepalived實現(xiàn)高可用,解決單點故障
  • 通過keepalived實現(xiàn)nginx雙活配置,解決nginx主備資源使用率50%問題
  • 通過dns輪詢解析域名到雙活vip,達(dá)到負(fù)載均衡效果
  • 后期nginx達(dá)到瓶頸應(yīng)考慮lvs+keepalived+nginx架構(gòu),動態(tài)擴(kuò)展nginx服務(wù)器

環(huán)境準(zhǔn)備

  • 服務(wù)器可以連通外網(wǎng)或者有內(nèi)網(wǎng)yum源服務(wù)器,本次實驗服務(wù)器可連通外網(wǎng)
  • nginx01和nginx02服務(wù)器需要在同一網(wǎng)段的網(wǎng)絡(luò)內(nèi)
  • 保證各服務(wù)器之前網(wǎng)絡(luò)互通
  • 保證服務(wù)器的防火墻和selinux關(guān)閉
  • 必須對外提供域名訪問,否則只能使用其中一個vip
  • 內(nèi)網(wǎng)部署DNS服務(wù)器,模擬DNS輪詢解析

1、網(wǎng)絡(luò)架構(gòu)

2、實驗服務(wù)器分布

主機ip操作系統(tǒng)軟件端口vip
nginx01192.168.56.101Centos7.6nginx keepalived80192.168.56.200
nginx02192.168.56.106Centos7.6nginx keepalived80192.168.56.201
fcs01192.168.56.101Centos7.6tomcat8080 
fcs02192.168.56.106Centos7.6tomcat8080 
共享存儲192.168.56.108Centos7.6nfs  
緩存192.168.56.108Centos7.6redis6379 
內(nèi)部DNS192.168.56.108Centos7.6bind53 

3、redis

部署服務(wù)器:192.168.56.108

3.1 配置redis

/etc/redis.conf

# 監(jiān)聽地址
bind 0.0.0.0
# 認(rèn)證密碼
requirepass yozosoft

3.2 啟動redis

systemctl enable redis --now && systemctl status redis

4、nfs

4.1 配置nfs

192.168.56.108(服務(wù)端)

# 創(chuàng)建存儲目錄
mkdir -p /opt/yozo/data
# 修改權(quán)限
chown -R nfsnobody.nfsnobody /opt/yozo/data
# 修改配置文件
vim /etc/exports
	/opt/yozo/data 192.168.56.0/24(rw,sync,all_squash)

192.168.56.101/192.168.56.106(客戶端)

# 創(chuàng)建掛載點
mkdir -p /opt/yozo/data
# 掛載nfs共享目錄
mount -t nfs 192.168.56.108:/opt/yozo/data /opt/yozo/data

4.2 啟動nfs

systemctl enable rpcbind nfs --now && systemctl status rpcbind nfs

5、fcsserver

部署服務(wù)器:

192.168.56.101(fcsserver01)

192.168.56.106(fcsserver02)

5.1 部署fcs

以tomcat為中間件,本次實驗fcs安裝目錄

/opt/yozo/fcsserver/webapps/fcsserver,/opt/yozo/fcsserver為解壓后的tomcat

部署項目包

mkdir opt/yozo/fcsserver/webapps/fcsserver -p
unzip fcscloud.war -d opt/yozo/fcsserver/webapps/fcsserver

修改fcsserver配置文件

# /opt/yozo/fcsserver/webapps/fcsserver/WEB-INF/classes/config.properties
inputDir=/opt/yozo/data/fcsdata/input	# 必須指定掛載共享存儲目錄的
outputDir=/opt/yozo/data/fcsdata/output
# 如果不提供域名,就只能配置其中一個vip;如果配置為域名,則緩存后,通過vip和fcsserver的ip將不能訪問轉(zhuǎn)換的緩存文件
viewDomain=http://www.fcsserver.com/fcsserver/
# /opt/yozo/fcsserver/webapps/fcsserver/WEB-INF/classes/application.yml
cache:                            #采用哪種緩存數(shù)據(jù)方式
    type: redis                     #local,redis,mysql(local模式只適用于單機,集群部署不支持)
  redis:
    enable: true                    #redis開關(guān)(預(yù)覽設(shè)置權(quán)限時需要使用redis,并發(fā)和異步waitting機制使用redis,必開)
 redis:
    database: 1 # Redis數(shù)據(jù)庫索引(默認(rèn)為0)
    timeout: 10000 #設(shè)置客戶端超時時間,單位是毫秒,默認(rèn)為2000
    password: yozosoft #密碼
    #單機版
    host: 192.168.56.108
    port: 6379
# /opt/yozo/fcsserver/webapps/fcsserver/WEB-INF/classes/
<property name="LOG_HOME">../logs</property>

5.2 配置fcs系統(tǒng)服務(wù)

配置fcsserver.service

# cat /usr/lib/systemd/system/fcsserver.service
[Unit]
Description=fcsserver Service.
After=network.target
[Service]
Type=forking
Environment="PATH=/opt/yozo/jdk-8u251-amd64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
WorkingDirectory=/opt/yozo/fcsserver/bin
ExecStart=/opt/yozo/fcsserver/bin/startup.sh
Restart=always
PrivateTmp=true
# 可以指定相關(guān)用戶啟動fcsserver
# User=yozo
# Group=yozo
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target

如果以普通用戶啟動,需要將tomcat目錄屬主屬組設(shè)置成相應(yīng)賬戶

# 此次實驗以yozo用戶啟動
chown -R yozo. /opt/yozo/fcsserver

5.3 啟動fcs

systemctl enable fcsserver --now && systemctl status fcsserver

6、nginx

部署服務(wù)器:

192.168.56.101(nginx01)

192.168.56.106(nginx02)

6.1 配置nginx

/etc/nginx/conf.d/fcsserver.conf配置

server {
    ....
    location ~ /fcsserver {
        add_header Cache-Control private,no-store,max-age=0,no-cache,must-revalidate,post-check=0,pre-check=0;
        proxy_redirect off;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded_Proto "http";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_request_buffering off;
        proxy_read_timeout 7200;
        proxy_send_timeout 7200;
        proxy_pass http://fcsserver;
    }
   ....
}
upstream fcsserver {
    server 192.168.56.101:8080 fail_timeout=60s;
    server 192.168.56.106:8080 fail_timeout=60s;
    keepalive 256;
}

6.2 啟動nginx

systemctl enable nginx --now && systemctl status nginx

7、keepalived

部署服務(wù)器:

192.168.56.101(nginx01)

192.168.56.106(nginx02)

7.1 配置keepalived

7.1.1 nginx01配置

/etc/keepalived/keepalived.conf

! Configuration File for keepalived
global_defs {
   router_id proxy1
}
vrrp_script chk_nginx {
  script "/etc/keepalived/check_nginx.sh"
  interval 2
  weight 20
  fall 3
  rise 2
}
vrrp_instance VI_1 {
    state MASTER
    interface enp0s3
    virtual_router_id 51
    priority 100                           
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.56.200                     
    }
    track_script {
        chk_nginx
    }
}
vrrp_instance VI_2 {
    state BACKUP
    interface enp0s3
    virtual_router_id 52
    priority 90                            
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.56.201                     
    }
    track_script {
        chk_nginx
    }
}

7.1.2 nginx02配置

# 備份keepalived.conf
mv /etc/keepalived/keepalived.conf /etc/keepalived/keepalived.confbak

/etc/keepalived/keepalived.conf

! Configuration File for keepalived
global_defs {
   router_id proxy2
}
vrrp_script chk_nginx {
  script "/etc/keepalived/check_nginx.sh"
  interval 2
  weight 20
  fall 3
  rise 2
}
vrrp_instance VI_1 {
    state BACKUP
    interface enp0s8
    virtual_router_id 51
    priority 90
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.56.200
    }
    track_script {
        chk_nginx
    }
}
vrrp_instance VI_2 {
    state MASTER
    interface enp0s8
    virtual_router_id 52
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.56.201
    }
    track_script {
        chk_nginx
    }
}

雙機/etc/keepalived/check_nginx.sh

#!/bin/bash
#時間變量,用于記錄日志
d=`date --date today +%Y%m%d_%H:%M:%S`
#計算nginx進(jìn)程數(shù)量
n=`ps -C nginx --no-heading|wc -l`
#如果進(jìn)程為0,則啟動nginx,并且再次檢測nginx進(jìn)程數(shù)量,
#如果還為0,說明nginx無法啟動,此時需要關(guān)閉keepalived
if [ $n -eq "0" ]; then
        /etc/init.d/nginx start
        n2=`ps -C nginx --no-heading|wc -l`
        if [ $n2 -eq "0"  ]; then
                echo "$d nginx down,keepalived will stop" >> /var/log/check_ng.log
                systemctl stop keepalived
        fi
fi

7.2 啟動keepalived

systemctl enable keepalived --now && systemctl status keepalived

nginx01

nginx02

7.3 模擬故障

7.3.1 nginx01手動關(guān)閉nginx

nginx故障后,keepalived會自動啟動nginx

7.3.2 nginx01手動關(guān)閉keepalived

nginx01的vip將會綁定到nginx02上面,nginx02將會出現(xiàn)2個vip,2個vip均可以訪問fcsserver

8、DNS服務(wù)器部署

用于模擬公網(wǎng)DNS輪詢解析,實際使用中是在域名提供商處配置指向映射外網(wǎng)ip

8.1 配置dns

/etc/named.conf

zone "fcsserver.com" IN {
        type master;
        file "fcsserver.com.zone";
};
zone "56.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.56.zone";
};

/var/named/fcsserver.com.zone

$TTL    86400
@               IN SOA  tom jerry (                     ; tom & jerry 這兩個參數(shù)本應(yīng)是主機名和郵件地址,這里隨便填寫,沒有問題
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                IN NS           ns.fcsserver.com.            ; notice : don't forget the dot in the end
                IN MX 10        mail.fcsserver.com.
www             IN A            192.168.56.200
www             IN A            192.168.56.201
ns              IN A            192.168.56.108
mail            IN A            192.168.56.108

/var/named/192.168.56.zone

$TTL    86400
@       IN      SOA     ns.fcsserver.com. root (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      ns.fcsserver.com.
200     IN      PTR     www.fcsserver.com.
201     IN      PTR     www.fcsserver.com.
108     IN      PTR     mail.fcsserver.com.
108     IN      PTR     ns.fcsserver.com.

修改權(quán)限

chown named. /var/named/ -R

8.2 啟動dns服務(wù)

systemctl enable named --now && systemctl status named

9、驗證

目標(biāo):本次實驗有2個vip 192.168.56.200 和 192.168.56.201,需要驗證www.fcsserver.com分別解析到2個vip上,并確認(rèn)每個vip后端服務(wù)正??捎?/p>

9.1 客戶端dns配置

測試期間,禁用其他網(wǎng)卡,只留虛擬機網(wǎng)卡

添加DNS

9.2 DNS緩存清理

9.3 域名訪問測試

測試之前需要確認(rèn)此次DNS解析是否指向所需測試的VIP,如果不是請刷新DNS緩存

需要測試www.fcsserver.com --> 192.168.56.200和www.fcsserver.com --> 192.168.56.201

文件轉(zhuǎn)換測試

轉(zhuǎn)換文件訪問測試

注:fcsserver的配置文件中viewDomain配置為域名,故轉(zhuǎn)換文件預(yù)覽連接只能通過www.fcsserver.com可以正常訪問,通過vip、nginx ip、fcsserver ip均不可以訪問

以上就是永中文檔在線轉(zhuǎn)換預(yù)覽雙活基于nginx的實現(xiàn)方案的詳細(xì)內(nèi)容,更多關(guān)于nginx永中文檔在線轉(zhuǎn)換預(yù)覽的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • mac 下 安裝nginx的方法小結(jié)

    mac 下 安裝nginx的方法小結(jié)

    這里簡單記錄一下在mac系統(tǒng)下安裝nginx的方法,推薦給大家,有需要的小伙伴可以參考下。
    2015-03-03
  • Nginx負(fù)載均衡下的webshell連接的實現(xiàn)

    Nginx負(fù)載均衡下的webshell連接的實現(xiàn)

    在解決shell文件上傳問題、命令執(zhí)行漂移等困難后,可實現(xiàn)正常的webshell上傳,本文主要介紹了Nginx負(fù)載均衡下的webshell連接的實現(xiàn),具有一定的參考價值,感興趣的可以了解一下
    2024-01-01
  • nginx: [warn]

    nginx: [warn] "log_format" directive used only on "http" lev

    這篇文章主要介紹了nginx: [warn] "log_format" directive used only on "http" level 解決方法,需要的朋友可以參考下
    2014-08-08
  • nginx基礎(chǔ)配置說明一則

    nginx基礎(chǔ)配置說明一則

    nginx基礎(chǔ)配置說明一則,有需要的朋友可以參考下
    2013-02-02
  • Nginx配置HTTP強制跳轉(zhuǎn)到HTTPS的解決辦法

    Nginx配置HTTP強制跳轉(zhuǎn)到HTTPS的解決辦法

    這篇文章主要給大家介紹了關(guān)于Nginx配置HTTP強制跳轉(zhuǎn)到HTTPS的解決辦法,當(dāng)Nginx配置https后通常需要將用戶http請求強制跳轉(zhuǎn)到https,需要的朋友可以參考下
    2023-08-08
  • 利用nginx訪問日志如何記錄mysql中的用戶id詳解

    利用nginx訪問日志如何記錄mysql中的用戶id詳解

    這篇文章主要給大家介紹了關(guān)于利用nginx訪問日志如何記錄mysql中用戶id的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面跟著小編一起來學(xué)習(xí)學(xué)習(xí)吧。
    2017-07-07
  • 前端異常502?bad?gateway的原因和解決辦法

    前端異常502?bad?gateway的原因和解決辦法

    本文詳細(xì)講解了前端異常502?bad?gateway的原因和解決辦法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧<BR>
    2021-12-12
  • Nginx跨域設(shè)置Access-Control-Allow-Origin無效的解決辦法

    Nginx跨域設(shè)置Access-Control-Allow-Origin無效的解決辦法

    今天小編就為大家分享一篇關(guān)于Nginx跨域設(shè)置Access-Control-Allow-Origin無效的解決辦法,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧
    2019-02-02
  • 設(shè)置Nginx允許上傳文件的大小的代碼詳解

    設(shè)置Nginx允許上傳文件的大小的代碼詳解

    這篇文章主要給大家介紹了關(guān)于設(shè)置Nginx允許上傳文件的大小的方法,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)Nginx有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)吧
    2024-01-01
  • 一文詳解nginx中的root與alias

    一文詳解nginx中的root與alias

    Nginx是一款流行的高性能Web服務(wù)器和反向代理服務(wù)器,這篇文章主要給大家介紹了關(guān)于如何通過一文詳解nginx中的root與alias的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2023-11-11

最新評論