快一服務(wù)器部署用戶部署手冊_第1頁
快一服務(wù)器部署用戶部署手冊_第2頁
快一服務(wù)器部署用戶部署手冊_第3頁
快一服務(wù)器部署用戶部署手冊_第4頁
快一服務(wù)器部署用戶部署手冊_第5頁
已閱讀5頁,還剩74頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

快一服務(wù)器部署用戶部署手冊目錄TOC\o"1-3"\h\u第一章系統(tǒng)說明 51.1系統(tǒng)背景 51.2系統(tǒng)構(gòu)成 51.3系統(tǒng)技術(shù) 5第二章服務(wù)器架構(gòu) 52.1服務(wù)器架構(gòu)需求 52.2服務(wù)器架構(gòu) 52.3服務(wù)器架構(gòu)拓展 6第三章服務(wù)器硬件規(guī)格 73.1服務(wù)器規(guī)格 7第四章軟件版本規(guī)格 74.1版本規(guī)格 7第五章服務(wù)器對應(yīng)服務(wù) 75.1服務(wù)器對應(yīng)的服務(wù) 7第六章系統(tǒng)環(huán)境安裝 86.1數(shù)據(jù)庫安裝 86.1.1安裝mysql依賴庫bison 86.1.2安裝mysql依賴庫cmake 86.1.3安裝mysql依賴庫ncurses 96.1.4安裝mysql依賴庫ncurses-devel 96.1.5安裝mysql依賴庫boost庫 96.1.6建立數(shù)據(jù)庫用戶用戶組 96.1.7編譯安裝 96.1.8設(shè)置數(shù)據(jù)庫目錄權(quán)限 106.1.9設(shè)置f 106.1.10數(shù)據(jù)庫初始化 116.1.11設(shè)置環(huán)境變量 116.1.12修改初始密碼 116.1.13設(shè)置mysql服務(wù) 116.2安裝nginx系統(tǒng) 116.2.1安裝依賴pcre 126.2.2安裝依賴zlib 126.2.3安裝依賴openssl 126.2.4安裝安裝--with-http_geoip_module模塊依賴 126.2.5安裝--with-http_image_filter_module模塊依賴 136.2.6建用戶組用戶 136.2.7編譯安裝nginx 136.3JDK安裝 146.3.1安裝 146.3.2配置環(huán)境變量 146.4安裝web服務(wù)器tomcat 146.4.1安裝tomcat 146.4.2配置環(huán)境變量 146.5安裝FTP服務(wù)器 156.5.1安裝ftp服務(wù)器 156.5.2配置用戶用戶組 156.5.3配置ftp服務(wù)器 156.6安裝緩存服務(wù)器memcached 166.6.1安裝依賴libevent 166.6.2安裝memcached 16第七章系統(tǒng)發(fā)布環(huán)境部署 167.1安裝svn 167.1.1安裝svn 167.1.2創(chuàng)建廠庫 167.1.3修改svnserve.conf 167.1.4配置authz 177.1.5配置passwd 177.2安裝maven工具 187.2.1安裝maven依賴jdk 187.2.2安裝maven 187.2.3設(shè)置環(huán)境變量 187.2.4添加本地廠庫 187.2.5配置在線更新包 18第八章編寫發(fā)布腳步 198.1編寫kuaiyi-product-admin-0 198.2編寫kuaiyi-product-admin-0 198.3編寫kuaiyi-product-admin 198.4編寫117admin.sh 20第九章快一域名配置解析 219.1域名解析 21第十章配置nginx 2210.1管理端nginx配置 2210.2app-nginx配置 2310.3微信nginx配置 2410.4官網(wǎng)及貨主pc端nginx配置 2510.5app下載配置 2710.6圖片訪問代理 2810.7百度地圖正向代理 3010.8百度鷹眼正向代理 3010.9短信正向代理 3110.10支付寶正向代理 3310.11微信支付正向代理 3410.12郵件正向代理 35第十一章Tomcat配置 3511.1修改管理端tomcat配置 3511.2修改微信端tomcat配置 3511.3修改app端tomcat配置 3611.4修改app端(蘋果審核)tomcat配置 3611.5修改快一官網(wǎng)及貨主pc端tomcat配置 3611.6修改app下載tomcat配置 3611.7修改微信退款tomcat配置 37第十二章Tomcat內(nèi)存優(yōu)化 3712.1管理端tomcat內(nèi)存優(yōu)化 3712.2微信端tomcat內(nèi)存優(yōu)化 3712.3app端內(nèi)存優(yōu)化 3712.4快一官網(wǎng)及貨主pc端內(nèi)存優(yōu)化 3712.5微信退款端tomcat內(nèi)存優(yōu)化 3712.6app下載端tomcat內(nèi)存優(yōu)化 3812.7蘋果審核端tomcat內(nèi)存優(yōu)化 38第十三章圖片服務(wù)器配置 3813.1配置圖片nginx服務(wù)器 38第十四章啟動服務(wù) 3914.1啟動nginx服務(wù) 3914.2啟動Tomcat服務(wù) 3914.3啟動memcached服務(wù) 3914.4啟動vsftpd服務(wù) 3914.5啟動mysql服務(wù) 3914.6啟動svn服務(wù) 40第十五章配置防火墻 4015.1nginx1防火墻配置 4015.2nginx2配置防火墻 4115.3配置管理服務(wù)器防火墻 42第十六章服務(wù)器監(jiān)控 4416.1Hostmonitor安裝 4516.2rma代理安裝 4516.3配置監(jiān)控策略 4616.3.1默認監(jiān)控策略 4616.3.2自定義策略 47第一章系統(tǒng)說明1.1系統(tǒng)背景物流行業(yè)發(fā)展到現(xiàn)在,傳統(tǒng)的物流模式(企業(yè)—物流公司—運輸公司—信息部—司機)暴露出了很大的缺點。一是:中間環(huán)節(jié)過多,導(dǎo)致層層加價,物流成本高企;二是中間環(huán)節(jié)過多,導(dǎo)致信息溝通成本高,信息不及時;三是,傳統(tǒng)物流企業(yè)重運輸,輕服務(wù);四是:國內(nèi)運輸車輛90%是個人運營,導(dǎo)致配貨成本高。而快一物流,結(jié)合互聯(lián)網(wǎng)技術(shù),采用物流+互聯(lián)網(wǎng)+金融的產(chǎn)業(yè)鏈模式,省去中間繁縟環(huán)節(jié)(企業(yè)—快一物流平臺—司機)實現(xiàn)快速有效的車貨匹配,物流成本的有效降低,以及物流間的更多服務(wù)(如資金,數(shù)據(jù)統(tǒng)計,保險等)。1.2系統(tǒng)構(gòu)成快一物流平臺由快一網(wǎng)站,貨主(貨主PC端,貨主APP,貨主微信端),司機(司機APP,司機微信端),以及快一平臺管理系統(tǒng)組成。1.3系統(tǒng)技術(shù)快一平臺采用JAVA+MYSQL+TOMCAT開發(fā),服務(wù)器采用流行的lINUX系統(tǒng)部署。第二章服務(wù)器架構(gòu)2.1服務(wù)器架構(gòu)需求快一平臺必須滿足高流量的訪問。單一的服務(wù)器部署雖然簡單快速,缺點也很明顯,擴展性,安全性,大流量訪問等不足。系統(tǒng)開發(fā)階段也考慮了這些情況。系統(tǒng)采用的是分布式開發(fā),當(dāng)然,服務(wù)器部署也要采用分布式部署。2.2服務(wù)器架構(gòu)如圖所示,服務(wù)器有2條獨立的線路,1條是生產(chǎn)環(huán)境,1條是測試環(huán)境。對于生產(chǎn)環(huán)境,前端采用nginx作為反向代理和負載均衡,后端采用tomcat未web服務(wù)器提供服務(wù),數(shù)據(jù)庫,文件服務(wù)器單獨部署。而測試環(huán)境出于節(jié)約成本考慮,前端也是采用nginx作為反向代理,后端web應(yīng)該,數(shù)據(jù)庫,文件服務(wù)器部署在1臺上。而整個服務(wù)器環(huán)境,設(shè)置了1臺管理機,所有的登錄入口都在這臺管理機。對于服務(wù)器的安全以及預(yù)警,部署了1臺監(jiān)控機。監(jiān)控系統(tǒng)運行情況。2.3服務(wù)器架構(gòu)拓展當(dāng)平臺流量增大,當(dāng)前架構(gòu)不能滿足訪問時候,除了系統(tǒng)本身的優(yōu)化外,服務(wù)器架構(gòu)的拓展至關(guān)重要。服務(wù)器架構(gòu)的拓展要分析原因。如果是訪問量過高,web發(fā)服務(wù)器擁堵,這個時候就需要作web服務(wù)的負載均衡。,如圖所示(綠色虛線就是擴展的服務(wù)器)數(shù)據(jù)庫數(shù)據(jù)量大查詢多時,數(shù)據(jù)庫往往也是性能瓶頸之一。對于數(shù)據(jù)庫的高并發(fā)大數(shù)據(jù)庫解決方案有很多,如優(yōu)化sql,分庫分表等,但從服務(wù)器角度,可以擴展數(shù)據(jù)庫服務(wù)器,并行提供服務(wù)。如圖所示(紫色虛線所示)當(dāng)然性能瓶頸還有其他的,如文件讀寫慢,以及前端代理服務(wù)器轉(zhuǎn)發(fā)阻塞等情況,和上面的擴展類似。第三章服務(wù)器硬件規(guī)格快一平臺服務(wù)器采用的是阿里云。云服務(wù)器一大優(yōu)點是,讓用戶專注于服務(wù),而服務(wù)器硬件的管理調(diào)整由云服務(wù)完成。快一平臺目前采用l11臺阿里云服務(wù)器。3.1服務(wù)器規(guī)格快一平臺服務(wù)器規(guī)格如下:服務(wù)器名稱系統(tǒng)cpu內(nèi)存硬盤帶寬Nginx1Linux2核4G50GB8MbpsNginx2Linux2核4G60GB8MbpsKuai156-pcLinux4核8G60GB0MbpsKuai56-appLinux4核8G60GB0MbpsKuai156-mwchatLinux4核8G60GB0Mbpsimages-memcachedLinux4核8G500GB0MbpsmysqlLinux4核8G60GB0MbpsmanageLinux2核4G50GB1MbpsmonitorWindows1核2G40GB1MbpsnginxtLinux1核2G40GB1Mbpskuai156-testLinux4核8G60GB0Mbps第四章軟件版本規(guī)格4.1版本規(guī)格軟件規(guī)格備注jdkjdk-7u79-linux-x64.rpmtomcatapache-tomcat-7.0.69.tar.gzmysqlmysql-5.7.10.tar.gzsvnsvn1.6.11mavenapache-maven-3.3.9-bin.tar.gzftpvsftpd-2.2.2-27.1.x86_64.rpmnginxnginx-1.10.3.tar.gziptablesiptablesv1.4.7HostMonitorMonitor9.4.6rmarma129_lin_x64.tgzmemcachedmemcached-1.4.25.tar.gz第五章服務(wù)器對應(yīng)服務(wù)快一平臺系統(tǒng)采用分布式部署,服務(wù)器對應(yīng)的服務(wù)如下:5.1服務(wù)器對應(yīng)的服務(wù)服務(wù)器名稱部署服務(wù)備注nginx1nginx代理服務(wù),iptables(防火墻)代理快一官網(wǎng),貨主pc端以及app下載應(yīng)用nginx2nginx代理服務(wù),iptables(防火墻),微信退款應(yīng)用服務(wù)代理快一管理系統(tǒng),微信端,app端應(yīng)用以及其他正向代理服務(wù)(如支付,郵件,短信,百度地圖等)kuai156-pc快一官網(wǎng),貨主pc端以及app下載應(yīng)用kuai56-appapp端應(yīng)用,以及蘋果審核應(yīng)用當(dāng)app升級的時候為了不影響現(xiàn)有系統(tǒng)使用,部署了審核應(yīng)用。kuai156-mwchat快一管理系統(tǒng),微信端,以及微信退款應(yīng)用微信退款的時候,請求需帶上微信支付證書文件,因而將微信退款單獨成一個服務(wù),部署在外網(wǎng)服務(wù)器上。images-memcachedVsftpd服務(wù),nginx(web服務(wù)),memcached緩存服務(wù)mysqlMysql服務(wù)managesvn+maven+shell(自動部署服務(wù)),iptables(防火墻+端口映射)Manage服務(wù)器是所有服務(wù)器登錄唯一入口(nginx1,nginx2服務(wù)雖有外網(wǎng)端口,單也只對manage開放).monitorHostmonitor監(jiān)控服務(wù)nginxtkuai156-test第六章系統(tǒng)環(huán)境安裝6.1數(shù)據(jù)庫安裝快一平臺采用的是mysql5.7,部署采用源碼安裝(相較于yum或者rpm安裝,源碼安裝的性能更高些)。系統(tǒng)部署在規(guī)格如下的服務(wù)器上:mysqlLinux4核8G60GB0Mbps6.1.1安裝mysql依賴庫bisonbison下載地址:/software/bison/;安裝如下:#tarzxvfbison-2.5.tar.gz#cdbison-2.5#./configure#make#makeinstall6.1.2安裝mysql依賴庫cmakecmake下載地址:/;安裝過程#tarzxvfcmake-2.8.4.tar.gz#cdcmake-2.8.4#./bootstrap#make#makeinstall6.1.3安裝mysql依賴庫ncursesncurses下載地址:/software/ncurses/;安裝如下#tarzxvfncurses-5.8.tar.gz#cdncurses-5.8#./configure#make#makeinstall6.1.4安裝mysql依賴庫ncurses-develyuminstall-yncurses-devel6.1.5安裝mysql依賴庫boost庫boost庫下載/users/download/boost.1.59.0.tar.gz放到/usr/local/boost6.1.6建立數(shù)據(jù)庫用戶用戶組#groupaddmysql#useraddmysql-gmysql-M-s/sbin/nologin6.1.7編譯安裝Mysql下載/downloads/解壓tar-zxvfmysql-5.710.tar.gzCdmysql-5.710編譯cmake-DMYSQL_USER=mysql-DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.7.10-DMYSQL_DATADIR=/usr/local/mysql/data-DSYSCONFDIR=/etc-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock-DMYSQL_TCP_PORT=3306-DEXTRA_CHARSETS=all-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DWITH_BOOST=/usr/local/boost-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_PARTITION_STORAGE_ENGINE=1-DWITH_FEDERATED_STORAGE_ENGINE=1-DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1-DWITH_MYISAM_STORAGE_ENGINE=1-DENABLED_LOCAL_INFILE=1安裝makemakeinstall注:Centos7下面默認安裝了mysql分支mariadb;先卸載rpm-qa|grepmariadbrpm-e--nodepsmariadb-libs-5.5.37-1.el7_0.x86_646.1.8設(shè)置數(shù)據(jù)庫目錄權(quán)限cd/usr/local/mysql5.7.10chown-Rroot:mysql.chown-Rmysql:mysqldata6.1.9設(shè)置fcpsupport-files/f/etc/fvi/etc/f[mysqld]basedir=/usr/local/mysqldatadir=/usr/local/mysql/dataport=3306lower_case_table_names=1socket=/tmp/mysqld.socktmpdir=/usr/local/mysql/datadefault-storage-engine=InnoDBexplicit_defaults_for_timestamp=trueskip-name-resolvemax_allowed_packet=32Mtable_open_cache=1024sort_buffer_size=2Mjoin_buffer_size=1Mnet_buffer_length=1Mread_buffer_size=2Mread_rnd_buffer_size=16Mthread_cache_size=300query_cache_size=256Mquery_cache_limit=2Mwait_timeout=120max_connections=5000max_connect_errors=6000server-id=1log-bin=/usr/local/mysql/logs/mysql-binbinlog-do-db=logisticsmax_binlog_size=500Mslow-query-log=ONlog-queries-not-using-indexes=ONslow_query_log_file=/usr/local/mysql/logs/mysql_slow_query.loglong_query_time=2log-error=/usr/local/mysql/logs/logistice.errcharacter-set-server=utf8collation-server=utf8_general_ciinnodb_file_per_table=1innodb_flush_log_at_trx_commit=1innodb_autoinc_lock_mode=1innodb_fast_shutdown=0innodb_buffer_pool_size=2Ginnodb_log_buffer_size=8Minnodb_log_file_size=128Minnodb_lock_wait_timeout=120innodb_flush_method=O_DIRECTsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES:wq保存退出6.1.10數(shù)據(jù)庫初始化./mysqld--initialize--datadir=/usr/local/mysql5.7.10/data如果是mysql5.6版本;初始化scripts/mysql_install_db--user=mysqlbasedir=/usr/local/mysql5.7.10-datadir=/usr/local/mysql5.7.10/data注:初始化說明:mysql_install_db文件位于$BASE_DIR/scripts目錄下(也就是mysql安裝目錄下),它是scripts目錄下的唯一文件。作用:主要是生成datadir下的文件1、用來初始化MySQL的數(shù)據(jù)目錄(datadirectory)和創(chuàng)建系統(tǒng)表(當(dāng)datadirectory和系統(tǒng)表不存在的時候)。2、也用來初始化innodb引擎管理使用的系統(tǒng)表空間(systemtablespace)和數(shù)據(jù)結(jié)構(gòu)(datastructure)。

從5.6.8開始,mysql_install_db變?yōu)閜erl腳本,可以在任何系統(tǒng)使用perl語言安裝。在5.6.8之前,它是shell,只能在unix平臺使用。

在unix平臺從5.6.8開始,執(zhí)行mysql_install_db會在mysql安裝目錄下產(chǎn)生一個默認的f文件,這個f文件是根據(jù)安裝目錄下的support-files/f創(chuàng)建的。使用mysqld_safe啟動時,默認使用這個f文件(/etc/f不存在的時候);如果這個f文件已經(jīng)存儲,mysql_install_db假設(shè)這個f在被使用,然后寫一個新文件叫做f。如果不想在安裝目錄下產(chǎn)生f文件,那么在mysql_install_db后加上--keep-my-cnf選項。mysql_install_db

OptionsFormatDescriptionIntroducedDeprecated--basedirPathtobasedirectory--builddirPathtobuilddirectory(forout-of-sourcebuilds)--cross-bootstrapForinternaluse--datadirPathtodatadirectory--defaults-extra-fileReadnamedoptionfileinadditiontousualoptionfiles--defaults-fileReadonlynamedoptionfile--forceRunevenifDNSdoesnotwork--helpDisplayhelpmessageandexit--keep-my-cnfKeepexistingffile,donotcreatenewone.20--ldataSynonymfor--datadir--no-defaultsReadnooptionfiles--random-passwordsGenerateadministrativeaccountrandompassword5.6.8--rpmForinternaluse--skip-name-resolveUseIPaddressesratherthanhostnamesingranttables--srcdirForinternaluse--userSystemloginuserunderwhichtoexecutemysqld--verboseVerbosemode--windowsForinternaluse

6.1.11設(shè)置環(huán)境變量vi/root/.bash_profilePATH=$PATH:$HOME/bin:/usr/local/mysql5.7.10/bin:/usr/local/mysql5.7.10/libsource/root/.bash_profile6.1.12修改初始密碼mysqld--skip-grant-tables以安全模式啟動數(shù)據(jù)庫(跳過權(quán)限表)mysql-uroot-p密碼處直接回車進入數(shù)據(jù)庫然后修改user表alteruser'root'@'localhost'identifiedby'mysql';6.1.13設(shè)置mysql服務(wù)cpsupport-files/mysql.server/etc/init.d/mysql然后可以用servicemysql(start|stop|restart)6.2安裝nginx系統(tǒng)Nginx功能強大,體積小,運行時占用的硬件資源很少。在快一平臺中。主要用于反向代理,負載均衡,以及正向代理。Nginx部署在如下服務(wù)器上:Nginx1Linux2核4G50GB8MbpsNginx2Linux2核4G60GB8Mbpsimages-memcachedLinux4核8G500GB0Mbps6.2.1安裝依賴pcretar-zxvfpcre-8.36.tar.gzcdpcre-8.36./configure--prefix=/usr/local/pcre-8.36makemakeinstall6.2.2安裝依賴zlibtar-zxvfzlib-1.2.8.tar.gzcdzlib-1.2.8./configure--prefix=/usr/local/zlib-1.2.8makemakeinstall6.2.3安裝依賴openssltar-zxvfopenssl-1.0.1c.tar.gzcdopenssl-1.0.1c./config--prefix=/usr/local/openssl-1.0.1cmakemakeinstall6.2.4安裝安裝--with-http_geoip_module模塊依賴MaxMind提供了免費的IP地域數(shù)據(jù)庫(GeoIP.dat),不過這個數(shù)據(jù)庫文件是二進制的,需要用GeoIP庫來讀取,所以除了要下載GeoIP.dat文件外(見下一步),還需要安裝能讀取這個文件的庫。#yuminstallzlib-devel#wget/download/geoip/api/c/GeoIP.tar.gz#tar-zxvfGeoIP.tar.gz#cdGeoIP-1.4.6#./configure#make;makeinstall安裝的庫自動安裝到/usr/local/lib下,所以這個目錄需要加到動態(tài)鏈接配置里面以便運行相關(guān)程序的時候能自動綁定到這個GeoIP庫:#echo'/usr/local/lib'>/etc/ld.so.conf.d/geoip.conf#ldconfigMaxMind提供了免費的IP地域數(shù)據(jù)庫,這個數(shù)據(jù)庫是二進制的,不能用文本編輯器打開,需要上面的GeoIP庫來讀取:國家wget/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz#gunzipGeoIP.dat.gz城市wget/download/geoip/database/GeoLiteCity.dat.gzgunzipGeoLiteCity.dat.gzyuminstallgeoip-devel6.2.5安裝--with-http_image_filter_module模塊依賴安裝libgd-2.2.4.tar.gztar-zxvflibgd-2.2.4.tar.gzcdlibgd-2.2.4./configuremakeMakeinstallyuminstall-ygd-devel6.2.6建用戶組用戶groupaddnginxuseradd-gnginx-s/sbin/nologinnginx6.2.7編譯安裝nginxtar-zxvfnginx-1.10.3.tar.gzcdnginx-1.10.3./configure--prefix=/usr/local/nginx1.10.3--pid-path=/var/run--user=nginx--group=nginx--with-http_ssl_module--with-http_stub_status_module--with-http_realip_module--with-http_sub_module--with-http_gzip_static_module--with-mail--with-mail_ssl_module--with-http_flv_module--with-http_mp4_module--with-http_gzip_static_module--with-http_image_filter_module--with-http_random_index_module--with-http_secure_link_module--with-ipv6--with-stream--with-http_addition_module--with-http_geoip_module--with-pcre=/home/nginx-rely/pcre-8.36--with-zlib=/home/nginx-rely/zlib-1.2.8--with-openssl=/home/nginx-rely/openssl-1.0.1cmakemakeinstall6.3JDK安裝快一平臺采用的是Java開發(fā)。運行java程序,必須先安裝jdk環(huán)境。以下服務(wù)器均裝。Kuai156-pcLinux4核8G60GB0MbpsKuai56-appLinux4核8G60GB0MbpsKuai156-mwchatLinux4核8G60GB0MbpsmanageLinux2核4G50GB1MbpsNginx2Linux2核4G60GB8Mbps先官網(wǎng)下載jdk包??煲挥玫氖莏dk-7u79-linux-x64.rpm。6.3.1安裝rpm-ivhjdk-7u79-linux-x64.rpm6.3.2配置環(huán)境變量Vi/etc/profile在最末加上JAVA_HOME=/usr/java/jdk1.7.0_79JRE_HOME=$JAVA_HOME/jrePATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/binCLASSPATH=:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/libexportJAVA_HOMEJRE_HOMEPATHCLASSPATH然后保存退出Source/etc/profile6.4安裝web服務(wù)器tomcat6.4.1安裝tomcatTomcat安裝比較簡單,只需解壓包即可。快一平臺采用的是tomcat7版本。到官網(wǎng)下載apache-tomcat-7.0.69.tar.gz。然后解壓就可。如果同一臺服務(wù)器上安裝有多個tomcat。只需重命名即可。如橙色欄服務(wù)器:Kuai156-pcLinux4核8G60GB0MbpsKuai56-appLinux4核8G60GB0MbpsKuai156-mwchatLinux4核8G60GB0MbpsNginx2Linux2核4G60GB8Mbps這臺服務(wù)器上面部署了快一管理端,以及貨主司機微信d端。就是部署的2個tomcat.tar-zxvfapache-tomcat-7.0.69.tar.gzmvapache-tomcat-7.0.69admin-tomcattar-zxvfapache-tomcat-7.0.69.tar.gzmvapache-tomcat-7.0.69weixin-tomcat6.4.2配置環(huán)境變量cd/admin-tomcat/binvicatalina.sh在頂部加入JAVA_HOME=/usr/java/jdk1.7.0_79CATALINA_BASE=/home/mwchat-tomcat/admin-tomcatCATALINA_HOME=/home/mwchat-tomcat/admin-tomcat:wq保存退出同理對于微信webcd/weixin-tomcat/binvicatalina.sh在頂部加入JAVA_HOME=/usr/java/jdk1.7.0_79CATALINA_BASE=/home/mwchat-tomcat/weixin-tomcatCATALINA_HOME=/home/mwchat-tomcat/weixin-tomcat:wq保存退出6.5安裝FTP服務(wù)器6.5.1安裝ftp服務(wù)器ftp服務(wù)器安裝比較簡單。直接yum安裝,快一平臺采用的是vsftpd工具。images-memcachedLinux4核8G500GB0Mbpsyuminstallvsftpd6.5.2配置用戶用戶組groupaddkuaiyiuseradd-d/home/ftpdir-s/sbin/nologin-gkuaiyikuaiyi接著設(shè)置用戶密碼passwdkuaiyi然后按提示操作6.5.3配置ftp服務(wù)器默認安裝是在/etc/vsftpd下。vi/etc/vsftpd.conf修改或者添加如下規(guī)則anonymous_enable=NOchroot_list_enable=YESchroot_list_file=/etc/vsftpd/chroot_listlisten_port=21pam_service_name=vsftpduserlist_enable=YEStcp_wrappers=YESpasv_enable=YESpasv_promiscuous=YESpasv_min_port=61001pasv_max_port=62000:wq保存退出。然后添加賬號echokuaiyi>./chroot_list(如沒又chroot_list文件,先創(chuàng)建,命令touchchroot_list)。6.6安裝緩存服務(wù)器memcached為提高快一平臺查詢數(shù)據(jù)的性能,采用了memcached作為數(shù)據(jù)的緩存。images-memcachedLinux4核8G500GB0Mbps6.6.1安裝依賴libevent#tarzxvflibevent-1.2.tar.gz#cdlibevent-1.2#./configure–prefix=/usr#make#makeinstall6.6.2安裝memcached#tarzxvfmemcached-1.2.0.tar.gz#cdmemcached-1.2.0#./configure–with-libevent=/usr#make#makeinstall第七章系統(tǒng)發(fā)布環(huán)境部署快一平臺由快一網(wǎng)站,貨主pc端,貨主app端,貨主微信端,司機app端,司機微信端,快一管理系統(tǒng)組成。由于系統(tǒng)組成較多,如采用傳統(tǒng)的ftp上傳,人工部署,不僅效率低,而且容易出錯??煲幌到y(tǒng)發(fā)布采用了svn+maven+shell的發(fā)布系統(tǒng)。7.1安裝svnmanageLinux2核4G50GB1Mbpssvn是快一代碼管理所用的工具7.1.1安裝svnyuminstall-ysubversion7.1.2創(chuàng)建廠庫mkdir-p/usr/svnsvnadmincreate/usr/svn/repos7.1.3修改svnserve.confvisvnserve.conf修改后如下anon-access=noneauth-access=writepassword-db=passwdauthz-db=authzrealm=respos7.1.4配置authz[groups]#技術(shù)組admin=zengyi,wangxztech=xjh,wangk,xjh2,xiyao,sunzuo,yangpan,liujh,shjsother=[respos:/]@admin=rw@tech=rw@other=r[respos:/code]@admin=rw@tech=@other=[respos:/doc]@admin=rw@tech=rw@other=r[respos:/sql]@admin=rw@tech=rw@other=r[respos:/ui]@admin=rw@tech=rw@other=r[respos:/logistics]@tech=rw@admin=rw@other=r[respos:/vv]@admin=rw@tech=rw@other=r7.1.5配置passwd[users]#harry=harryssecret#sally=sallyssecretzengyi=******xjh=******xjh2=******wangk=******xiat=******ybj=******wangxz=******penghao=******xiyao=******jingfei=******sunzuo=******yangpan=******liujh=******shjs=******7.2安裝maven工具manageLinux2核4G50GB1Mbpsmaven是快一平臺用來構(gòu)建系統(tǒng)所用的工具。7.2.1安裝maven依賴jdk安裝過程同上7.2.2安裝maventarvxfapache-maven-3.3.9-bin.tar.gzmvapache-maven-3.3.9/usr/local/maven-.3設(shè)置環(huán)境變量在/etc/profile中添加以下幾行MAVEN_HOME=/usr/local/maven-3.3.9exportMAVEN_HOME執(zhí)行source/etc/profile使環(huán)境變量生效7.2.4添加本地廠庫修改settings.xml文件添加配置<localRepository>/usr/local/mavenRepository</localRepository>7.2.5配置在線更新包修改settings.xml文件添加配置<offline>true</offline><mirror><id>nexus-aliyun</id><mirrorOf>central</mirrorOf><name>Nexusaliyun</name><url>/nexus/content/groups/public</url></mirror>第八章編寫發(fā)布腳步這里以管理端自動發(fā)布腳本為例:8.1編寫kuaiyi-product-admin-0#!/usr/bin/expectsettimeout-1sethost17setuserrootsetport22setpassword************spawnscp/kuai156-core/respos/logistics/kuaiyi/manager/target/kuaiyi-manager.warroot@17:/home/mwchat-tomcat/admin-tomcat/webappsexpect"password:"send"$password\r"expecteof8.2編寫kuaiyi-product-admin-0#!/usr/bin/expectsettimeout-1sethost17setuserrootsetport22setpassword************spawnssh$user@$host-p$port"sh/usr/local/publish-shell/117admin.sh"expect"password:"send"$password\r"expecteof8.3編寫kuaiyi-product-admin#!/bin/bashecho1>/proc/sys/vm/drop_cachesecho0>/proc/sys/vm/drop_cachesnowtime=`date+%Y%m%d%H%M%S`touch/kuaiyi-product-log/$nowtime.117admin.logcd/kuai156-core/respos/logistics/kuaiyimvncleansleep3svnupdate>/kuaiyi-product-log/$nowtime.117admin.logsleep3mvncleansleep3mvnpackagesleep3/home/kuai156-product-publish/kuaiyi-product-admin-rely/kuaiyi-product-admin-0sleep5/home/kuai156-product-publish/kuaiyi-product-admin-rely/kuaiyi-product-admin-18.4編寫117admin.sh#!/bin/bashnowtime=`date+%Y%m%d%H%M%S`ps-ef|grepadmin-tomcat|grep-vgrep|awk'{print$2}'|xargskill-9echo"/**********admin-tomcatstop11111111*************/"sleep5tar-zcvf/kuai156-backup/kuai156-admin/$nowtime.tar.gz/home/mwchat-tomcat/admin-tomcat/webapps/ROOT/*sleep20/home/mwchat-tomcat/admin-tomcat/bin/startup.shecho"/*****admin-tomcatstart111111111111***************/"sleep20ps-ef|grepadmin-tomcat|grep-vgrep|awk'{print$2}'|xargskill-9echo"/******admin-tomcatstop222222222*******************/"sleep5rm-rf/home/mwchat-tomcat/admin-tomcat/webapps/ROOTmkdir/home/mwchat-tomcat/admin-tomcat/webapps/ROOTsleep5cp-r-f-v/home/mwchat-tomcat/admin-tomcat/webapps/kuaiyi-manager/*/home/mwchat-tomcat/admin-tomcat/webapps/ROOT/echo"/*****************Induplicate************************/"sleep15rm-rf/home/mwchat-tomcat/admin-tomcat/webapps/ROOT/WEB-INF/classes/pertiescp/kuai156-replace/admin-file/perties/home/mwchat-tomcat/admin-tomcat/webapps/ROOT/WEB-INF/classes/rm-rf/home/mwchat-tomcat/admin-tomcat/webapps/ROOT/WEB-INF/classes/pertiescp/kuai156-replace/admin-file/perties/home/mwchat-tomcat/admin-tomcat/webapps/ROOT/WEB-INF/classes/cp/kuai156-replace/admin-file/alipay-sdk-java20161129201425.jar/home/mwchat-tomcat/admin-tomcat/webapps/ROOT/WEB-INF/lib/cp/kuai156-replace/admin-file/ueditor-1.1.2.jar/home/mwchat-tomcat/admin-tomcat/webapps/ROOT/WEB-INF/lib/rm-rf/home/mwchat-tomcat/admin-tomcat/webapps/ROOT/WEB-INF/classes/mybatis.cfg.xmlcp/kuai156-replace/admin-file/mybatis.cfg.xml/home/mwchat-tomcat/admin-tomcat/webapps/ROOT/WEB-INF/classes/rm-rf/home/mwchat-tomcat/admin-tomcat/webapps/kuaiyi-manager.warrm-rf/home/mwchat-tomcat/admin-tomcat/webapps/kuaiyi-manager#rm-rf/home/mwchat-tomcat/admin-tomcat/logs/*sleep5/home/mwchat-tomcat/admin-tomcat/bin/startup.shecho"/*************admin-tomcatstart222222222222*****************/"sleep50tail-n3000/home/mwchat-tomcat/admin-tomcat/logs/catalina.outexit第九章快一域名配置解析快一平臺系統(tǒng)域名對應(yīng)關(guān)系如下:服務(wù)器名稱對應(yīng)域名N,,N,,,9.1域名解析快一所有域名都是在DNSPOD上解析的。訪問/Login?r=/console然后輸入賬號密碼登錄這里可以進行一些域名解析的修改刪除以及添加。第十章配置nginxNginx的主要作用在于代理以及負載均衡。10.1管理端nginx配置vikuai156-admin.confserver{listen443;server_name1204.;sslon;ssl_certificate/home/ssl/213990924020791.pem;ssl_certificate_key/home/ssl/213990924020791.key;ssl_session_cacheshared:SSL:20m;ssl_session_timeout20m;ssl_protocolsTLSv1TLSv1.1TLSv1.2;ssl_ciphersAESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;ssl_prefer_server_cipherson;access_log/usr/local/nginx1.10.3/logs/kuai156-admin.logmain;charsetutf-8;client_max_body_size30m;proxy_connect_timeout80;proxy_read_timeout80;proxy_send_timeout80;gzipon;gzip_typestext/plaintext/cssapplication/jsonapplication/x-javascripttext/xmlapplication/xmlapplication/xml+rsstext/javascript;location/{proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;proxy_set_headerHost$http_host;proxy_set_headerX-Forwarded-Protohttps;proxy_redirectoff;proxy_pass17:8180/;}location=/532212.png{root/usr/local/nginx1.10.3/html;}location=/shengji.css{root/usr/local/nginx1.10.3/html;}location=/weihu.css{root/usr/local/nginx1.10.3/html;}#error_page404/404.html;error_page500502503504/maintain.html;location=/maintain.html{root/usr/local/nginx1.10.3/html;}}server{listen80;server_name1204.;rewrite^/(.*)$https://1204./$1permanent;}10.2app-nginx配置vikuai156-driver.confupstreamserver1{server31:8280;}upstreamserver2{server31:8210;}server{listen443;server_name;sslon;ssl_certificate/home/ssl/213991011720791.pem;ssl_certificate_key/home/ssl/213991011720791.key;ssl_session_cacheshared:SSL:20m;ssl_session_timeout20m;ssl_protocolsTLSv1TLSv1.1TLSv1.2;ssl_ciphersAESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;ssl_prefer_server_cipherson;#charsetkoi8-r;access_log/usr/local/nginx1.10.3/logs/kuai156-driver.logmain;charsetutf-8;client_max_body_size30m;proxy_connect_timeout80;proxy_read_timeout80;proxy_send_timeout80;gzipon;gzip_typestext/plaintext/cssapplication/jsonapplication/x-javascripttext/xmlapplication/xmlapplication/xml+rsstext/javascript;set$app_server"server1";if($arg_device_type~'^(d_1.2.2|b_1.1.2)$'){set$app_server"server2";}location/{#proxy_set_headerX-Real-IP$remote_addr;#proxy_set_headerHOST$http_host;#proxy_set_headerX-NginX-Proxytrue;proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;proxy_set_headerHost$http_host;proxy_set_headerX-Forwarded-Protohttps;proxy_redirectoff;proxy_passhttp://$app_server;}#error_page404/404.html;error_page500502503504/50x.html;location=/50x.html{root/usr/local/nginx1.10.3/html;}}10.3微信nginx配置vikuai156-wechat.confserver{listen443;server_name;sslon;ssl_certificate/home/webchatcert/214059157820791.pem;ssl_certificate_key/home/webchatcert/214059157820791.key;ssl_session_timeout5m;ssl_protocolsSSLv2SSLv3TLSv1;ssl_ciphersALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;ssl_prefer_server_cipherson;access_log/usr/local/nginx1.10.3/logs/kuai156-wechat.logmain;charsetutf-8;client_max_body_size30m;proxy_connect_timeout80;proxy_read_timeout80;proxy_send_timeout80;gzipon;gzip_typestext/plaintext/cssapplication/jsonapplication/x-javascripttext/xmlapplication/xmlapplication/xml+rsstext/javascript;location/{#proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;#proxy_set_headerHost$http_host;#proxy_set_headerX-Forwarded-Protohttps;#proxy_redirectoff;proxy_set_headeriphost$host;proxy_set_headerX-Real-IP-WX$remote_addr;proxy_set_headersforward$proxy_add_x_forwarded_for;proxy_pass17:8110/;}error_page500502503504/50x.html;location=/50x.html{root/usr/local/nginx1.10.3/html;}}server{listen80;server_name;rewrite(.*)$1permanent;}10.4官網(wǎng)及貨主pc端nginx配置vikuai156-web.confserver{listen443;server_name;sslon;ssl_certificate/home/ssl/213977965110791.pem;ssl_certificate_key/home/ssl/213977965110791.key;ssl_session_cacheshared:SSL:20m;ssl_session_timeout20m;ssl_protocolsTLSv1TLSv1.1TLSv1.2;ssl_ciphersAESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;ssl_prefer_server_cipherson;#charsetkoi8-r;access_log/usr/local/nginx1.10.3/logs/kuai156web.access.logmain;charsetutf-8;client_max_body_size30m;proxy_connect_timeout80;proxy_read_timeout80;proxy_send_timeout80;gzipon;gzip_typestext/plaintext/cssapplication/jsonapplication/x-javascripttext/xmlapplication/xmlapplication/xml+rsstext/javascript;location/{proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;proxy_set_headerHost$http_host;proxy_set_headerX-Forwarded-Protohttps;#proxy_redirectoff;proxy_pass5:8080/;}location=/532212.png{root/usr/local/nginx1.10.3/html;}location=/shengji.css{root/usr/local/nginx1.10.3/html;}location=/weihu.css{root/usr/local/nginx1.10.3/html;}#error_page404/404.html;error_page500502503504/maintain.html;location=/maintain.html{root/usr/local/nginx1.10.3/html;}}server{listen80;server_name;access_log/usr/local/nginx1.10.3/logs/kuai156web.access.logmain;charsetutf-8;client_max_body_size30m;proxy_connect_timeout80;proxy_read_timeout80;proxy_send_timeout80;gzipon;gzip_typestext/plaintext/cssapplication/jsonapplication/x-javascripttext/xmlapplication/xmlapplication/xml+rsstext/javascript;location^~/owner/{return301$request_uri;}location/{proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;proxy_set_headerHost$http_host;proxy_set_headerX-Forwarded-Protohttps;#proxy_redirectoff;proxy_pass5:8080/;}location=/532212.png{root/usr/local/nginx1.10.3/html;}location=/shengji.css{root/usr/local/nginx1.10.3/html;}location=/weihu.css{root/usr/local/nginx1.10.3/html;}#error_page404/404.html;error_page500502503504/maintain.html;location=/maintain.html{root/usr/local/nginx1.10.3/html;}}server{listen80;server_name;rewrite(.*)$1permanent;}server{listen443;server_name;rewrite(.*)$1permanent;}10.5app下載配置vikuai156-appdownload.confserver{listen443;server_name;sslon;ssl_certificate/home/ssl/213996366260791.pem;ssl_certificate_key/home/ssl/213996366260791.key;ssl_session_cacheshared:SSL:20m;ssl_session_timeout20m;ssl_protocolsTLSv1TLSv1.1TLSv1.2;ssl_ciphersAESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;ssl_prefer_server_cipherson;#access_log/usr/local/nginx1.10.3/logs

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論