自建cdn安装

一.主控安装命令

  1.1.主控服务器修改host

  1.2.主控安装命令

curl -fsSL http://您的ip/cdnfly/v5.1.13/master/master.sh -o master.sh && chmod +x master.sh && ./master.sh --es-dir /home/es

  1.3.初始化es 先下载es初始化脚本int_es.sh

cd /tmp
wget 您的下载域名/agent/int_es.sh -O int_es.sh;
chmod +x int_es.sh;
./int_es.sh /home/es; //es安装的目录
supervisorctl -c /opt/cdnfly/master/conf/supervisord.conf restart all;

二.被控安装命令

  2.1登录主控点击升级可直接看到被控安装命令

三.常见问题

3.1.节点维护无法同步数据检测

    /opt/cdnfly  节点主程序目录

运行如下命令查看节点报错信息修复一般是因为主控 nginx配置proxy_cache_keys_zone_size:自定义的共享内存太大修改小点就可以了

/usr/local/openresty/nginx/sbin/nginx -t

  3.2 另外一种错误节点无配置文件nginx.conf 或文件不全

     nginx路径 /usr/local/openresty/nginx/conf 进入目录后找安装成功的节点下载文件上传
启动nginx
/usr/local/openresty/nginx/sbin/nginx -s reload

 

  3.3 无法启动复制文件夹logs到下面路径然后启动

  /usr/local/openresty/nginx/logs

  3.4//节点监控无法启动 无数据图处理

sudo su - root
chown root /opt/cdnfly/agent/conf/filebeat.yml
chmod go-w /opt/cdnfly/agent/conf/filebeat.yml 设置权限
/usr/share/filebeat/bin/filebeat -e -c /opt/cdnfly/agent/conf/filebeat.yml 执行启动

  3.5终止节点nginx命令:

ps aux | grep [/]usr/local/openresty/nginx/sbin/nginx | awk '{print $2}' | xargs kill -HUP || true

 3.6重启节点命令

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

  3.7节点卸载

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

  3.8清空绑定的域名 绑定域名错误无法登录可用以下清理

eval grep MYSQL_PASS /opt/cdnfly/master/conf/config.py;
eval grep MYSQL_IP /opt/cdnfly/master/conf/config.py;
eval grep MYSQL_PORT /opt/cdnfly/master/conf/config.py;
eval grep MYSQL_DB /opt/cdnfly/master/conf/config.py;
eval grep MYSQL_USER /opt/cdnfly/master/conf/config.py;

mysql -h$MYSQL_IP -u$MYSQL_USER -p$MYSQL_PASS -P$MYSQL_PORT  $MYSQL_DB  -e "update config set value='' where name='admin_domain';";
mysql -h$MYSQL_IP -u$MYSQL_USER -p$MYSQL_PASS -P$MYSQL_PORT  $MYSQL_DB  -e "update config set value='' where name='user_domain';";

mysql -h$MYSQL_IP -u$MYSQL_USER -p$MYSQL_PASS -P$MYSQL_PORT $MYSQL_DB  -e "update config set value='' where name='bind-master-host';";
cd /opt/cdnfly/master/conf;
sed -i 's/ALLOW_HOSTS.*/ALLOW_HOSTS=""/' config.py;
supervisorctl restart all;

  3.9 替换节点的主控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;
chattr -i /usr/local/openresty/nginx/conf/listen_80.conf /usr/local/openresty/nginx/conf/listen_other.conf ;
chattr -i /usr/local/openresty/nginx/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 ;
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;

  4.0重置主控密码

eval  `grep MYSQL_PASS /opt/cdnfly/master/conf/config.py`;
eval  `grep MYSQL_IP /opt/cdnfly/master/conf/config.py`;
eval  `grep MYSQL_PORT /opt/cdnfly/master/conf/config.py`;
eval  `grep MYSQL_DB /opt/cdnfly/master/conf/config.py`;
eval  `grep MYSQL_USER /opt/cdnfly/master/conf/config.py`;
mysql -h$MYSQL_IP -u$MYSQL_USER -p$MYSQL_PASS -P$MYSQL_PORT  $MYSQL_DB  -e 'update user set password="$2b$12$UV5ttpNQizMfO.tiBk9ereZ53hDBW0.kak3qa/GRP6aVBfNMB1NsK" where name="admin" ';

  4.1初始化

cd /tmp;
wget http://us.centos.bz/cdnfly/int_es.sh -O int_es.sh;
chmod +x int_es.sh;
./int_es.sh /home/es;
© 版权声明
THE END
喜欢就支持一下吧
点赞9 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容