8225

UX168办公本地环境维护记录

上班到公司

1、打考勤靠、或处理考勤异常

2、钉钉

3、邮件、

4、禅道系统

5、开启nginx、node、monogo服务

5.1、开启nginx服务

/etc/init.d/apache2 stop /export/scripts/start_docker_nginx.sh #有mysqli镜像,无redis /export/scripts/start_docker_nginx_X.sh #有redis镜像,无mysqli

5.2、开启monogodb服务

/export/js/cets_nodejs_app/scripts/start_docker_mongodb.shroot@ux168-OptiPlex-3040:/export/js/cets_nodejs_app/scripts# /export/js/cets_nodejs_app/scripts/start_docker_mongodb.shdocker: Error response from daemon: Conflict. The container name "/mongodb" is already in use by container "74dbc51fe46e9a46c4135d5413ca682d34cf3115ec7642e0770f34ac5326aade". You have to remove (or rename) that container to be able to reuse that name.See 'docker run --help'.解决办法:docker rm 74dbc51fe46e

5.3、开启node服务

/export/js/cets_nodejs_app/scripts/start_docker_mongoose5.shroot@ux168-OptiPlex-3040:/export/js/cets_nodejs_app/scripts# /export/js/cets_nodejs_app/scripts/start_docker_mongoose5.shdocker: Error response from daemon: Conflict. The container name "/cets_nodejs_app" is already in use by container "ff02a81a22099543e56e90551d6f27722b4f898e193be43606a70a8812a6deae". You have to remove (or rename) that container to be able to reuse that name.See 'docker run --help'.解决办法:docker rm ff02a81a220

6、检查3个服务是否起来

root@ux168-OptiPlex-3040:/export/js/cets_nodejs_app/scripts# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 88c7b5ed9497 dockerimages-v2.ux168.cn:5000/v8_mongoose5 "/bin/sh -c 'cd /hom…" 56 seconds ago Up 55 seconds 3000/tcp, 3003/tcp, 3008-3009/tcp, 3013/tcp, 3015/tcp, 3018/tcp, 3020/tcp, 3022-3023/tcp, 3039/tcp, 5858/tcp, 6080-6081/tcp, 6083/tcp, 8000-8001/tcp, 8003/tcp, 8081/tcp, 9229/tcp, 12333/tcp, 0.0.0.0:3010->3010/tcp cets_nodejs_app 5f5caa376af4 dockerimages-v2.ux168.cn:5000/mongodb "/bin/sh -c /usr/bin…" 3 minutes ago Up 3 minutes 0.0.0.0:27017->27017/tcp mongodb 405c64311de4 dockerimages-v2.ux168.cn:5000/nginx:latest "/bin/sh -c '/etc/in…" 5 minutes ago Up 5 minutes 0.0.0.0:80->80/tcp happy_bell root@ux168-OptiPlex-3040:/export/js/cets_nodejs_app/scripts# netstat -nltp |grep docker-proxy tcp6 0 0 :::3010 :::* LISTEN 14964/docker-proxy tcp6 0 0 :::27017 :::* LISTEN 14758/docker-proxy tcp6 0 0 :::80 :::* LISTEN 14574/docker-proxy

7、进入node,pm2放前台运行,方便终端输出调试

root@ux168-OptiPlex-3040:/export/js/cets_nodejs_app/scripts# docker-nsenter 88c7b5ed9497 root@88c7b5ed9497:~# cd /home/mean root@88c7b5ed9497:/home/mean# pm2 list ┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬────────────┬──────────┐ │ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │ ├──────────┼────┼──────┼─────┼────────┼─────────┼────────┼─────┼────────────┼──────────┤ │ server │ 0 │ fork │ 420 │ online │ 0 │ 21s │ 0% │ 144.9 MB │ disabled │ └──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴────────────┴──────────┘ Use `pm2 show <id|name>` to get more details about an app root@88c7b5ed9497:/home/mean# pm2 stop 0 [PM2] Applying action stopProcessId on app [0](ids: 0) [PM2] [server](0) ✓ ┌──────────┬────┬──────┬─────┬─────────┬─────────┬────────┬─────┬────────┬──────────┐ │ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │ ├──────────┼────┼──────┼─────┼─────────┼─────────┼────────┼─────┼────────┼──────────┤ │ server │ 0 │ fork │ 0 │ stopped │ 0 │ 0 │ 0% │ 0 B │ disabled │ └──────────┴────┴──────┴─────┴─────────┴─────────┴────────┴─────┴────────┴──────────┘ Use `pm2 show <id|name>` to get more details about an app root@88c7b5ed9497:/home/mean# pm2 list ┌──────────┬────┬──────┬─────┬─────────┬─────────┬────────┬─────┬────────┬──────────┐ │ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │ ├──────────┼────┼──────┼─────┼─────────┼─────────┼────────┼─────┼────────┼──────────┤ │ server │ 0 │ fork │ 0 │ stopped │ 0 │ 0 │ 0% │ 0 B │ disabled │ └──────────┴────┴──────┴─────┴─────────┴─────────┴────────┴─────┴────────┴──────────┘ Use `pm2 show <id|name>` to get more details about an app root@88c7b5ed9497:/home/mean# node server.js [2019-08-28T19:58:21.365] [pid=588] [ INFO] - [2019-08-28T19:58:21.364] [pid=588] [ INFO] - mongoSwitch = 1[2019-08-28T19:58:21.366] [pid=588] [ INFO] - [2019-08-28T19:58:21.366] [pid=588] [ INFO] - slowQuery = 100[2019-08-28T19:58:21.393] [pid=588] [ INFO] - [2019-08-28T19:58:21.393] [pid=588] [ INFO] - masterMongoose    连接数据库成功!mongodb://172.16.10.62:27017/cets_test primary[2019-08-28T19:58:21.396] [pid=588] [ INFO] - [2019-08-28T19:58:21.396] [pid=588] [ INFO] - slaveMongoose    连接数据库成功!mongodb://172.16.10.62:27017/cets_test secondaryPreferred[2019-08-28T19:58:21.396] [pid=588] [ INFO] - [2019-08-28T19:58:21.396] [pid=588] [ INFO] - 默认数据库读方式:    secondaryPreferred[2019-08-28T19:58:22.706] [pid=588] [ WARN] - --[2019-08-28T19:58:22.708] [pid=588] [ WARN] - MEAN.JS - Development Environment[2019-08-28T19:58:22.708] [pid=588] [ WARN] - Environment:            development[2019-08-28T19:58:22.708] [pid=588] [ WARN] - Port:                3010[2019-08-28T19:58:22.709] [pid=588] [ WARN] - Database:            mongodb://172.16.10.62:27017/cets_test[2019-08-28T19:58:22.709] [pid=588] [ WARN] - App version:            0.4.2[2019-08-28T19:58:22.709] [pid=588] [ WARN] - MEAN.JS version:            0.4.2

8、服务有莫名Question,可以重启docker服务

root@ux168-OptiPlex-3040:/export/js/cets_nodejs_app/scripts# docker restart 405c64311de4

9、本地也安装了php、nginx,初衷是为了xdebug调试

php-fpm 9001

xdebug 9002

nginx 8080

开启停用本地nginx php-fpm

/usr/local/webserver/php/sbin/php-fpm /usr/local/nginx/sbin/nginx killall php-fpm killall nginx

来源:博客园

作者:人生很短,用心做好眼前的事情。

链接:https://www.cnblogs.com/hnhycnlc888/p/11426218.html

Recommend