去评论
dz插件网

H5棋牌游戏,《斗地主》《二人麻将》《血战到底》《血流成河》《锄大地》Docker下10分钟搭建,高负载,真正可成功架设的商业版!

BQQ
2022/10/29 04:29:33
搴旂敤鎴浘
搴旂敤涓績鍘熶环 200000
闄愭椂鐗规儬 50
褰撳墠鐗堟湰 0
搴 瀛 99999
鏇存柊鏃ユ湡 2022-10-29
缃戠洏涓嬭浇 閾炬帴: https://pan.baidu.com/s/1wqb_p9HeEz9HIZ8t1fqZUA?pwd=2020 鎻愬彇鐮: 2020
QQ瀹㈡湇 1909859577
搴旂敤鍒嗙被 鏁寸珯婧愮爜
搴旂敤鍥炬爣
鏈笘鏈鍚庣敱 BQQ 浜 2022-10-29 04:36 缂栬緫




绋冲畾鐨勫晢鐢 H5缃戦〉鐗 妫嬬墝娓告垙銆婃枟鍦颁富銆嬨婁簩浜洪夯灏嗐嬨婅鎴樺埌搴曘嬨婅娴佹垚娌炽嬨婇攧澶у湴銆嬶紝绠鍖栦簡閰嶇疆杩囩▼锛屾湁linux鍩虹鐨勶紝鎸夌収鏁欑▼鍩烘湰鍑犲垎閽熷彲鎼缓鎴愬姛銆



鐪熸鑳界敤鐨勬鐗屾父鎴忋


鈥斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺
1. 鐜瀹夎
1.1 瀹夎docker(centos7.x)
鈥 宸茬粡瀹夎docker鐨勫拷鐣ユ湰姝ラ锛寉um瀹夎鏂规硶鑷鏌ヨ锛寃indows绯荤粺瀹夎鏂规硶鑷鏌ヨ銆


瀹夎docker



  1. [xxx@docker ~]# curl -fsSL get.docker.com -o get-docker.sh
  2. [xxx@docker ~]# sudo sh get-docker.sh --mirror Aliyun


鍒涘缓docker鐢ㄦ埛缁勶紝灏嗗綋鍓嶇敤鎴峰姞鍏ocker缁



  1. [xxx@docker ~]# sudo groupadd docker
  2. [xxx@docker ~]# sudo usermod -aG docker $USER


docker 浣跨敤鏂规硶



  1. [xxx@docker ~]# sudo systemctl enable docker
  2. [xxx@docker ~]# sudo systemctl start docker


docker閰嶇疆闃块噷浜戦暅鍍忓姞閫



  1. [xxx@docker ~]# sudo mkdir -p /etc/docker
  2. [xxx@docker ~]# sudo tee /etc/docker/daemon.json <<-'EOF'
  3. {
  4.   "registry-mirrors": ["https://lz2nib3q.mirror.aliyuncs.com"]
  5. }
  6. EOF
  7. [xxx@docker ~]# sudo systemctl daemon-reload
  8. [xxx@docker ~]# sudo systemctl restart docker


1.2 瀹夎docker-compose
1.2.1 linux绯荤粺瀹夎鏂规硶
鍦 Linux 涓婄殑涔熷畨瑁呭崄鍒嗙畝鍗曪紝浠 瀹樻柟 GitHub Release 澶勭洿鎺ヤ笅杞界紪璇戝ソ鐨勪簩杩涘埗鏂囦欢鍗冲彲銆備緥濡傦紝鍦 Linux 64 浣嶇郴缁熶笂鐩存帴涓嬭浇瀵瑰簲鐨勪簩杩涘埗鍖呫

  1. [xxx@docker ~]# sudo curl -L https://github.com/docker/compose/releases/download/1.28.6/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
  2. [xxx@docker ~]# sudo chmod +x /usr/local/bin/docker-compose


1.2.2 macos銆亀indow绯荤粺瀹夎鏂规硶
Compose 鍙互閫氳繃 Python 鐨勫寘绠$悊宸ュ叿 pip 杩涜瀹夎锛屼篃鍙互鐩存帴涓嬭浇缂栬瘧濂界殑浜岃繘鍒舵枃浠朵娇鐢紝鐢氳嚦鑳藉鐩存帴鍦 Docker 瀹瑰櫒涓繍琛屻侱ocker Desktop for Mac/Windows 鑷甫 docker-compose 浜岃繘鍒舵枃浠讹紝瀹夎 Docker 涔嬪悗鍙互鐩存帴浣跨敤銆


浣跨敤pip浠ヤ笅鍛戒护涓嬭浇


  1. [xxx@docker ~]# pip install docker-compose


瀹樻柟release涓嬭浇鍦板潃锛https://github.com/docker/compose/releases


2. 鍒涘缓骞跺惎鍔ㄦ父鎴忔湇鍔¢泦缇
2.1 涓嬭浇娓告垙鏈嶅姟闆嗙兢闇瑕佺殑渚濊禆
2.1.1 鍒涘缓宸ヤ綔鐩綍

  1. [xxx@docker ~]# mkdir -p /data
  2. [xxx@docker ~]# mkdir -p /data/etcd-data


2.1.2 瀹夎git鏈嶅姟 (宸插畨瑁呯殑鍙洿鎺ュ拷鐣)

  1. [xxx@docker ~]# yum install git -y

2.1.3 鍏嬮殕渚濊禆鍒版湰鍦板苟灏嗘枃浠惰В鍘嬪埌宸ヤ綔鐩綍


  1. [xxx@docker ~]# cd /data
  2. [xxx@docker ~]# git clone https://github.com/openinggame/qp.git
  3. [xxx@docker ~]# cd qp
  4. [xxx@docker ~]# tar zxf mongodb.tar.gz -C /data
  5. [xxx@docker ~]# tar zxf mysqldb.tar.gz -C /data


绗竴閬嶄笅杞藉緢鍙兘鏄笉鎴愬姛鐨勶紝鐢氳嚦绗簩閬嶃佺涓夐亶閮戒細涓嶆垚鍔燂紝浣嗘槸涓嶈鎱岋紝杩欎篃璁稿彧鏄綉缁滅殑闂锛屼笅杞借繃绋嬫湁涓涓椂闂撮檺鍒讹紝瓒呰繃浜嗚繖涓檺鍒跺氨浼氫笅杞藉け璐ワ紝澶氶噸澶嶅嚑娆★紝鎬讳細鎴愬姛鐨勶紱褰撴渶鍚庝竴琛岀粨灏惧嚭鐜 鈥渄one鈥 杩欎釜璇嶆椂锛屽氨琛ㄧず涓嬭浇鎴愬姛浜嗐
/data 宸ヤ綔鐩綍缁撴瀯

  1. [xxx@docker ~]# tree /data
  2. data
  3. 鈹溾攢鈹 etcd-data     # etcd data-dir
  4. 鈹溾攢鈹 mongo_data    # mongodb 鏁版嵁鍗
  5. 鈹溾攢鈹 mysql         # mysql 鏁版嵁鍗
  6. 鈹斺攢鈹 qp            # docker compose
  7.     鈹斺攢鈹 docker-compose.yml


2.2 涓嬭浇闀滃儚
杩欐鍙互鐣ヨ繃锛屾墽琛屽埌 姝ラ2.3 鍚姩闆嗙兢鏃朵細鍏堟娴嬮暅鍍忥紝鑻ユ病鏈変細鑷姩涓嬭浇锛屼絾闀滃儚涓嬭浇澶辫触浼氬惎鍔ㄥけ璐ャ


鎺ㄨ崘涓嶈鐣ヨ繃鏈楠わ紝鍏堟妸闀滃儚pull鍒版湰鍦般



  1. [xxx@docker ~]# docker pull mysql:8.0.23
  2. [xxx@docker ~]# docker pull mongo:4.4.4
  3. [xxx@docker ~]# docker pull quay.io/coreos/etcd:v3.2.32
  4. [xxx@docker ~]# docker pull wurstmeister/zookeeper
  5. [xxx@docker ~]# docker pull wurstmeister/kafka:2.12-2.3.0
  6. [xxx@docker ~]# docker pull redis:latest
  7. [xxx@docker ~]# docker pull openinggame/web:v1
  8. [xxx@docker ~]# docker pull openinggame/server:v1


2.3 鍒涘缓闆嗙兢缃戠粶

  1. [xxx@docker ~]# docker network create -d bridge game

2.4 鍚姩闆嗙兢

濡傛灉娌℃湁鎵ц 2.1 鐨勬楠わ紝杩欓噷娑堣楃殑鏃堕棿姣旇緝涔咃紝閫熷害鍙栧喅浣犵殑缃戠粶璐ㄩ噺銆


2.4.1 淇敼docker-compose.yml鏂囦欢
淇敼绗10琛 web鏈嶅姟鐨処P鍦板潃 <ip鍦板潃> 涓烘湇鍔″櫒鐨処P鍦板潃锛

  1. #    绗10琛   - API_HOST=<ip鍦板潃>


  2. #渚嬪IP鍦板潃涓猴細192.168.1.6 ,淇敼docker-compose.yml涓瓀eb鏈嶅姟鐨凙PI_HOST鐨勫笺傦紙绗 10 琛岋級
  3.   web:
  4.     container_name: web0
  5.     image: openinggame/web:v1
  6.     ports:
  7.       - "80:80"
  8.     environment:
  9.       - API_HOST=192.168.1.6    #淇敼杩欒鐨 IP 鍦板潃涓轰綘鐨勬湇鍔″櫒IP鍦板潃
  10.     networks:
  11.       - game
  12.     depends_on:
  13.       - server
  14. # ...


Cento7.x 鏌ヨip鍦板潃鏂规硶锛堟帹鑽愪娇鐢ㄥ浐瀹欼P鍦板潃锛

  1. [xxx@docker ~]# ifconfig eth0 | grep 'inet ' | tr -s ' ' | cut -d ' ' -f3
  2. [xxx@docker ~]# 192.168.1.6


2.4.2 閫氳繃 docker-compose 鍚姩娓告垙鏈嶅姟闆嗙兢

  1. [xxx@docker ~]# cd /data/qp
  2. [xxx@docker ~]# docker-compose up -d


3. 寮濮嬫父鎴
3.1 鎵撳紑娴忚鍣紙璋锋瓕娴忚鍣級杈撳叆娓告垙鏈嶅姟鍣ㄧ殑IP鍦板潃
娓告垙鐨勫湴鍧灏辨槸涓婇潰鏌ヨ鍒扮殑鏈嶅姟鍣↖P鍦板潃 : http://192.168.1.6
3.2 棣栨鐧婚檰锛屼娇鐢ㄦ父瀹㈢櫥闄嗭紝鐐瑰嚮 娓稿鐧婚檰 鎸夐挳杩涘叆娓告垙銆
鎵цdocker-compose鍚姩闆嗙兢鍚庯紝瑕佺瓑寰呮墍鏈夋湇鍔″櫒鍚姩璧锋潵鎵嶅彲浠ヨ繘鍏ユ父鎴忋




3.3 杩涘叆娓告垙鍚庯紝鐐瑰嚮 绔嬪嵆娉ㄥ唽锛岀粦瀹氭墜鏈哄彿鐮侊紙鍙风爜闅忔剰杈撳叆11浣嶆暟瀛楋級銆
鎵嬫満鍙风爜鍙互闅忔剰杈撳叆 11 浣嶆暟瀛楋紝鑷繁璁扮墷灏卞彲浠ヤ簡銆




3.3.1 杈撳叆鎵嬫満鍙风爜锛岀劧鍚庣偣鍑昏幏鍙栭獙璇佺爜銆


3.3.2 杈撳叆瀵嗙爜锛岀劧鍚庣偣鍑 缁戝畾 鎸夐挳锛岀粦瀹氭垚鍔熷悗锛屼笅娆$櫥闄嗗彲浠ヤ娇鐢 鎵嬫満鍙风爜+瀵嗙爜 鐨勬柟寮忕櫥闄嗐

鈥斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺



浜叉祴鏋惰鎴愬姛鍙甯镐娇鐢紝璐拱鍚庢湁涓嶆噦鐨勫彲浠ュ湪甯栧唴璺熷笘浜ゆ祦銆