幫助中心
這里有最新的使用文檔和教程
cdnfly開心版一鍵搭建腳本-轉自網絡
1.主控服務器 web目錄為驗證文件,請自行搭建 0.0.0.0改成(自己搭建的驗證服務器Ip)
vi /etc/hosts 0.0.0.0 auth.cdnfly.cn monitor.cdnfly.cn
0.0.0.0 auth.cdnfly.cn monitor.cdnfly.cn 2.主控 v5.1.11版本安裝腳本: curl -fsSL http://cdnfly.zhibai.cloud/master.sh -o master.sh && chmod +x master.sh && ./master.sh --es-dir /home/es
新v5.1.13版本安裝腳本:
curl -fsSL http://cdnfly.zhibai.cloud/cdnfly/v5.1.13/master/master.sh -o master.sh && chmod +x master.sh && ./master.sh --es-dir /home/es
3.被控 v5.1.15版本安裝腳本: curl -fsSL -m 5 http://cdnfly.zhibai.cloud/agent/agent.sh -o agent.sh || curl -m 5 http://cdnfly.zhibai.cloud/agent/agent.sh -o agent.sh && chmod +x agent.sh && ./agent.sh --master-ver v5.1.11 --master-ip ip --es-ip ip --es-pwd passwd
新v5.1.16版本安裝腳本: curl -fsSL -m 5 http://cdnfly.zhibai.cloud/cdnfly/v5.1.13/agent/agent.sh -o agent.sh || curl -m 5 http://cdnfly.zhibai.cloud/cdnfly/v5.1.13/agent/agent.sh -o agent.sh && chmod +x agent.sh && ./agent.sh --master-ver v5.1.11 --master-ip ip --es-ip ip --es-pwd passwd
已安裝過官方版的開心方法: 執行以下命令完成開心: wget http://cdnfly.zhibai.cloud/cdnfly/api.py -O /opt/venv/lib/python2.7/site-packages/requests/api.py supervisorctl -c /opt/cdnfly/master/conf/supervisord.conf reload
如果舊版本要升級,可以先更新自建云端的文件,然后執行“已安裝過官方版的開心方法”這一部分的命令,最后在主控后臺升級。
云端節點監控功能說明:
監控默認是使用云端服務器去請求CDN節點,因此要保持云端和CDN節點之間的網絡暢通。另外如果是用寶塔面板,php不要安裝bt_safe擴展,否則無法使用tcp類型監控;如果要用ping類型監控,還需要允許exec函數。 支持多節點監控(和官方一樣),要添加其它監控節點,可以編輯config.php配置文件,根據里面的注釋說明添加。
修改為你自身安裝節點,或使用默認的github節點安裝 /opt/cdnfly/master/panel/src/views/system/update/index.html
主控登錄地址為: http://主控IP/ 管理員賬號和密碼: admin/cdnfly 普通用戶賬號和密碼: jason/cdnfly
卸載節點 cd /tmp/ && curl -m 5 http://dl2.cdnfly.cn/cdnfly/agent_uninstall.sh -o agent_uninstall.sh || curl -m 5 http://us.centos.bz/cdnfly/agent_uninstall.sh && chmod +x agent_uninstall.sh && ./agent_uninstall.sh
服務器配置要求
主控 1.內存 - 因為主控安裝有Elasticsearch,推薦16G及以上,如果網站訪問量比較小,8G也行,至少4G。 2.硬盤 - 建議固態硬盤, 同樣考慮訪問日志大小,推薦100G及以上,量小的話都可以。 3.CPU - CPU至少2核 4.開放80 88 9200端口 節點
1.內存 - 至少2G及以上 2.硬盤 - 根據網站緩存的大小配置 3.CPU - Nginx主要是跑CPU,所以要想訪問性能好,CPU盡量好點。 4.開放80 443 5000端口 系統 支持Centos-7---Ubuntu-16.04
官方最新公共 尊敬的cdnfly用戶: 目前發現登錄安全漏洞,需要及時按照如下方法來臨時修復。找-個只有你知道的域名,這個域名用于管理員登錄。 如的域名,不用帶http://,路徑為:系統管理--->系統設置--->用戶相關,限制管理員只能從此域名登錄
搬遷主控 注意:下面的遷移步驟不包括遷移elasticsearch的數據 1 備份舊主控數據 在舊主控執行如下命令開始備份(注意:備份前會停止舊主控的進程)
cd /root curl http://us.centos.bz/cdnfly/backup_master.sh -o backup_master.sh chmod +x backup_master.sh ./backup_master.sh 這時候將在目錄/root下,打包生成cdn.sql.gz文件,請把這個文件傳輸到新主控的/root/目錄下,可以使用scp命令,命令如下:
cd /root scp cdn.sql.gz root@新主控IP:/root/ 2 在新機器安裝好主控程序 首先登錄cdnfly.cn,更新授權為新主控ip,并清空機器碼 登錄舊主控機器,執行如下命令查看版本:
grep VERSION_NAME /opt/cdnfly/master/conf/config.py 如下圖,版本為v4.1.6:
登錄新機器,執行如下命令安裝:
curl http://dl.cdnfly.cn/cdnfly/master.sh -o master.sh chmod +x master.sh ./master.sh --ver v4.1.60 其中v4.1.60替換成自己的主控版本號 3 登錄新主控,恢復備份 執行如下命令恢復
cd /root curl http://us.centos.bz/cdnfly/restore_master.sh -o restore_master.sh chmod +x restore_master.sh ./restore_master.sh 從舊主控下載/opt/cdnfly/master/conf/config.py上傳到新主控覆蓋 然后在新主控初始化es,重啟新主控 執行如下命令初始化:
cd /tmp wget us.centos.bz/cdnfly/int_es.sh -O int_es.sh chmod +x int_es.sh ./int_es.sh /home/es supervisorctl restart all 其中/var/lib/elasticsearch為es的數據目錄,可以更改成其它的,比如/home/es
4 替換節點里的主控IP 一個個登錄節點,執行如下命令替換
new_master_ip="這里替換為新主控IP" sed -i "s/ES_IP =./ES_IP = "$new_master_ip"/" /opt/cdnfly/agent/conf/config.py sed -i "s/MASTER_IP./MASTER_IP = "$new_master_ip"/g" /opt/cdnfly/agent/conf/config.py sed -i "s/hosts:.*/hosts: ["$new_master_ip:9200"]/" /opt/cdnfly/agent/conf/filebeat.yml logs_path=awk '/error_log/{print $2}' /usr/local/openresty/nginx/conf/nginx.conf | sed 's/error.log//' if [[ echo $logs_path | grep ^/ != "" ]];then sed -i "s#.*access.log# - $logs_path/access.log#" /opt/cdnfly/agent/conf/filebeat.yml sed -i "s#.stream.log# - $logs_path/stream.log#" /opt/cdnfly/agent/conf/filebeat.yml fi sed -i "s#http://.:88#http://$new_master_ip:88#" /usr/local/openresty/nginx/conf/listen_80.conf /usr/local/openresty/nginx/conf/listen_other.conf ps aux | grep [/]usr/local/openresty/nginx/sbin/nginx | awk '{print $2}' | xargs kill -HUP || true supervisorctl restart filebeat supervisorctl restart agent supervisorctl restart task
主控更換ip后節點修改命令
new_master_ip="這里替換為主控IP" (后臺系統升級里查看es_pwd密碼) es_pwd="這里替換為es密碼"
sed -i "s/ES_IP =.*/ES_IP = "$new_master_ip"/" /opt/cdnfly/agent/conf/config.py
sed -i "s/MASTER_IP.*/MASTER_IP = "$new_master_ip"/g" /opt/cdnfly/agent/conf/config.py
sed -i "s/hosts:.*/hosts: ["$new_master_ip:9200"]/" /opt/cdnfly/agent/conf/filebeat.yml
chattr -i /usr/local/openresty/nginx/conf/ /usr/local/openresty/nginx/conf/listen_80.conf /usr/local/openresty/nginx/conf/listen_other.conf
sed -i "s#http://.*:88#http://$new_master_ip:88#" /usr/local/openresty/nginx/conf/listen_80.conf /usr/local/openresty/nginx/conf/listen_other.conf
chattr +i /usr/local/openresty/nginx/conf/ /usr/local/openresty/nginx/conf/listen_80.conf /usr/local/openresty/nginx/conf/listen_other.conf
sed -i "s/ES_PWD =.*/ES_PWD = "$es_pwd"/" /opt/cdnfly/agent/conf/config.py
sed -i "s/password:.*/password: "$es_pwd"/" /opt/cdnfly/agent/conf/filebeat.yml
sed -i "s/agent-pwd:.*/agent-pwd: "$es_pwd"/" /opt/cdnfly/agent/conf/filebeat.yml
ps aux | grep [/]usr/local/openresty/nginx/sbin/nginx | awk '{print $2}' | xargs kill -HUP || true
supervisorctl -c /opt/cdnfly/agent/conf/supervisord.conf restart filebeat
supervisorctl -c /opt/cdnfly/agent/conf/supervisord.conf restart agent
supervisorctl -c /opt/cdnfly/agent/conf/supervisord.conf restart task
gitee鏈接https://gitee.com/to_white/cdnfly-happy
本文轉自網絡,如侵權,請聯系刪除。