linux服务器 项目部署

beego后端

本机(Ubuntu)需要的环境:git、云db、前后端环境、pm2、ssh
------------------------------------------------


生成秘钥
查看秘钥:
cat .ssh/id_rsa.pub


将traceability_management_linux 拖到 Linux


复制到远程主机:
zaolabs@dev:~$ scp traceability_management_linux root@47.104.15.63:/tmp/


连接:
zaolabs@dev:~$ ssh root@47.104.15.63
The authenticity of host '47.104.15.63 (47.104.15.63)' can't be established.
ECDSA key fingerprint is SHA256:Z9JSe38qo61dXonljMxYMtSx13LIOZ6f+6b9XBYKOl8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '47.104.15.63' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-117-generic x86_64)
 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
New release '18.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Welcome to Alibaba Cloud Elastic Compute Service !

Last login: Wed Jul  3 18:03:40 2019 from 114.94.9.238
root@prdd:~# ls
abcd.tar.gz  app_webview  traceability_management
root@prdd:~# ls
abcd.tar.gz  app_webview  traceability_management
root@prdd:~# exit
logout
Connection to 47.104.15.63 closed.


查看远程主机的目录:
root@prdd:~# ls /tmp/
Aegis-<Guid(5A2C30A2-A87D-490A-9281-6765EDAD7CBA)>  npm-23580-5a7ad0dc  traceability_management_linux                         vscode-ipc-835c7057-53b6-42a3-adfe-5bad58490915.sock
CmsGoAgent.pid                                      npm-29125-2fd403be  v8-compile-cache-0                                    vscode-ipc-af6fb140-152e-48c3-bf42-72153fe16efc.sock
aaa.sql                                             npm-29141-33d595ab  vscode-ipc-2dca16b6-877a-40b7-b160-441bd8e6f96b.sock  vscode-ipc-f0eb2117-843f-468a-8be7-a75fc65f1908.sock
abcd.tar.gz                                         npm-29561-2c64c750  vscode-ipc-6f44fb17-0202-47c2-b307-3a5cc7ad0a6f.sock  vscode-ipc-f175b45e-c44e-46e7-813d-217b8c881ee0.sock
h5.tar.gz   


将traceability_management_linux重命名为traceability_management_linux.0703(即:备份已有的):
mv 文件名 文件名  将源文件名改为目标文件名
mv 文件名 目录名  将文件移动到目标目录
root@prdd:~/traceability_management# mv traceability_management_linux traceability_management_linux.0703


移动tmp目录下的traceability_management_linux到当前目录下:
root@prdd:~/traceability_management# mv /tmp/traceability_management_linux ./


查看当前目录:
root@prdd:~/traceability_management# ls
app   static   traceability_management_linux       traceability_management_linux.bak   traceability_management_linux.noscanrecord
conf  swagger  traceability_management_linux.0703  traceability_management_linux.bak1


查看当前的运行的程序:
root@prdd:~# pm2 list
┌───────────────────────────────┬────┬─────────┬──────┬───────┬────────┬─────────┬────────┬──────┬───────────┬──────┬──────────┐
│ App name                      │ id │ version │ mode │ pid   │ status │ restart │ uptime │ cpu  │ mem       │ user │ watching │
├───────────────────────────────┼────┼─────────┼──────┼───────┼────────┼─────────┼────────┼──────┼───────────┼──────┼──────────┤
│ app_webview                   │ 7  │ N/A     │ fork │ 12272 │ online │ 0       │ 40m    │ 0.2% │ 42.5 MB   │ root │ disabled │
│ h5                            │ 4  │ N/A     │ fork │ 6038  │ online │ 0       │ 24h    │ 0.2% │ 49.8 MB   │ root │ disabled │
│ main                          │ 1  │ N/A     │ fork │ 6030  │ online │ 0       │ 24h    │ 0%   │ 37.6 MB   │ root │ disabled │
│ official                      │ 0  │ N/A     │ fork │ 6022  │ online │ 0       │ 24h    │ 0.2% │ 50.0 MB   │ root │ disabled │
│ resource_upload_linux         │ 3  │ N/A     │ fork │ 6032  │ online │ 0       │ 24h    │ 0%   │ 6.6 MB    │ root │ disabled │
│ trace_frontend                │ 2  │ N/A     │ fork │ 8547  │ online │ 2       │ 9h     │ 0.2% │ 47.4 MB   │ root │ disabled │
│ traceability_management_linux │ 6  │ N/A     │ fork │ 10128 │ online │ 1       │ 23h    │ 0.1% │ 51.7 MB   │ root │ disabled │
└───────────────────────────────┴────┴─────────┴──────┴───────┴────────┴─────────┴────────┴──────┴───────────┴──────┴──────────┘


修改权限:
root@prdd:~/traceability_management# chmod a+x traceability_management_linux


启动当前新的程序:
root@prdd:~/traceability_management# pm2 start traceability_management_linux


返回以下则表示成功:
[PM2] Starting /root/traceability_management/traceability_management_linux in fork_mode (1 instance)
[PM2] Done.
┌───────────────────────────────┬────┬─────────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬──────┬──────────┐
│ App name                      │ id │ version │ mode │ pid   │ status │ restart │ uptime │ cpu │ mem       │ user │ watching │
├───────────────────────────────┼────┼─────────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼──────┼──────────┤
│ app_webview                   │ 5  │ N/A     │ fork │ 14180 │ online │ 0       │ 36s    │ 0%  │ 44.9 MB   │ root │ disabled │
│ h5                            │ 4  │ N/A     │ fork │ 14179 │ online │ 0       │ 36s    │ 0%  │ 45.0 MB   │ root │ disabled │
│ main                          │ 1  │ N/A     │ fork │ 14166 │ online │ 0       │ 36s    │ 0%  │ 36.3 MB   │ root │ disabled │
│ official                      │ 0  │ N/A     │ fork │ 14160 │ online │ 0       │ 36s    │ 0%  │ 44.8 MB   │ root │ disabled │
│ resource_upload_linux         │ 3  │ N/A     │ fork │ 14170 │ online │ 0       │ 36s    │ 0%  │ 8.9 MB    │ root │ disabled │
│ trace_frontend                │ 2  │ N/A     │ fork │ 14168 │ online │ 0       │ 36s    │ 0%  │ 44.7 MB   │ root │ disabled │
│ traceability_management_linux │ 6  │ N/A     │ fork │ 14316 │ online │ 0       │ 0s     │ 0%  │ 7.3 MB    │ root │ disabled │
└───────────────────────────────┴────┴─────────┴──────┴───────┴────────┴─────────┴────────┴─────┴───────────┴──────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app


查看日志:
root@prdd:~/traceability_management# pm2 logs 6

nuxt vue前端 (末尾附db操作)

打开目录:
root@prdd:~/traceability_management# cd /opt
root@prdd:/opt# ls
callback_api         containerd  gogs-repositories  latest.tar.gz     openproject      scanner                wordpress      wordpress.nuxt
callback_api.tar.gz  git         htdocs             official_website  resource_upload  traceability_frontend  wordpress.bak


打开项目目录:
root@prdd:/opt# cd traceability_frontend/
root@prdd:/opt/traceability_frontend# ls
assets  components  dist  layouts  logs  node_modules  nuxt.config.js  package-lock.json  package.json  pages  plugins  pm2.json  server  static  store


拉取代码:
root@prdd:/opt/traceability_frontend# git pull 


构建:
root@prdd:/opt/traceability_frontend# npm run build


查看当前运行:
root@prdd:/opt/traceability_frontend# pm2 list
┌───────────────────────────────┬────┬─────────┬──────┬───────┬────────┬─────────┬────────┬──────┬───────────┬──────┬──────────┐
│ App name                      │ id │ version │ mode │ pid   │ status │ restart │ uptime │ cpu  │ mem       │ user │ watching │
├───────────────────────────────┼────┼─────────┼──────┼───────┼────────┼─────────┼────────┼──────┼───────────┼──────┼──────────┤
│ app_webview                   │ 5  │ N/A     │ fork │ 14180 │ online │ 0       │ 5m     │ 0.1% │ 40.4 MB   │ root │ disabled │
│ h5                            │ 4  │ N/A     │ fork │ 14179 │ online │ 0       │ 5m     │ 0.1% │ 41.3 MB   │ root │ disabled │
│ main                          │ 1  │ N/A     │ fork │ 14166 │ online │ 0       │ 5m     │ 0%   │ 36.3 MB   │ root │ disabled │
│ official                      │ 0  │ N/A     │ fork │ 14160 │ online │ 0       │ 5m     │ 0.1% │ 41.5 MB   │ root │ disabled │
│ resource_upload_linux         │ 3  │ N/A     │ fork │ 14170 │ online │ 0       │ 5m     │ 0%   │ 8.9 MB    │ root │ disabled │
│ trace_frontend                │ 2  │ N/A     │ fork │ 14168 │ online │ 0       │ 5m     │ 0.1% │ 40.8 MB   │ root │ disabled │
│ traceability_management_linux │ 6  │ N/A     │ fork │ 14316 │ online │ 0       │ 5m     │ 0%   │ 15.2 MB   │ root │ disabled │
└───────────────────────────────┴────┴─────────┴──────┴───────┴────────┴─────────┴────────┴──────┴───────────┴──────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app



重启当前:
root@prdd:/opt/traceability_frontend# pm2 restart 2
Use --update-env to update environment variables
[PM2] Applying action restartProcessId on app [2](ids: 2)
[PM2] [trace_frontend](2) ✓
┌───────────────────────────────┬────┬─────────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬──────┬──────────┐
│ App name                      │ id │ version │ mode │ pid   │ status │ restart │ uptime │ cpu │ mem       │ user │ watching │
├───────────────────────────────┼────┼─────────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼──────┼──────────┤
│ app_webview                   │ 5  │ N/A     │ fork │ 14180 │ online │ 0       │ 7m     │ 0%  │ 41.1 MB   │ root │ disabled │
│ h5                            │ 4  │ N/A     │ fork │ 14179 │ online │ 0       │ 7m     │ 0%  │ 41.0 MB   │ root │ disabled │
│ main                          │ 1  │ N/A     │ fork │ 14166 │ online │ 0       │ 7m     │ 0%  │ 36.3 MB   │ root │ disabled │
│ official                      │ 0  │ N/A     │ fork │ 14160 │ online │ 0       │ 7m     │ 0%  │ 41.0 MB   │ root │ disabled │
│ resource_upload_linux         │ 3  │ N/A     │ fork │ 14640 │ online │ 1       │ 91s    │ 0%  │ 8.2 MB    │ root │ disabled │
│ trace_frontend                │ 2  │ N/A     │ fork │ 14736 │ online │ 1       │ 0s     │ 0%  │ 12.9 MB   │ root │ disabled │
│ traceability_management_linux │ 6  │ N/A     │ fork │ 14316 │ online │ 0       │ 6m     │ 0%  │ 15.2 MB   │ root │ disabled │
└───────────────────────────────┴────┴─────────┴──────┴───────┴────────┴─────────┴────────┴─────┴───────────┴──────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app






加表重新构建发布的过程:
root@prdd:/opt/traceability_frontend# mycli -uroot
Password: 
mysql 5.7.24-0ubuntu0.16.04.1
mycli 1.19.0
Chat: https://gitter.im/dbcli/mycli
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - cxbig
mysql root@(none):(none)> use traceability;                                                                                                                                                                 
You are now connected to database "traceability" as user "root"
Time: 0.000s
mysql root@(none):traceability> show tables;                                                                                                                                                                
+------------------------+
| Tables_in_traceability |
+------------------------+
| address                |
| api                    |
| capacity               |
| chain                  |
| department             |
| device                 |
| device_vendor          |
| duty                   |
| filiale                |
| group                  |
| h5_audit               |
| logsheet               |
| logsheet_frequency     |
| logsheet_record        |
| monitor_video          |
| randomtest_note        |
| sample                 |
| scan_record            |
| supplier               |
| support                |
| user                   |
| vehicle                |
| version                |
| warning                |
+------------------------+
24 rows in set
Time: 0.018s
mysql root@(none):traceability> CREATE TABLE `warning_ visualization` ( 
                                  `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 
                                  `blacklist` int(11) NOT NULL DEFAULT '0', 
                                  `credentials` int(11) NOT NULL DEFAULT '0', 
                                  `process` int(11) NOT NULL DEFAULT '0', 
                                  `device` int(11) NOT NULL DEFAULT '0', 
                                  `monitoring` int(11) NOT NULL DEFAULT '0', 
                                  `health` int(11) NOT NULL DEFAULT '0', 
                                  `total` int(11) NOT NULL DEFAULT '0', 
                                  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, 
                                  PRIMARY KEY (`id`) 
                                ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;                                                                                                                      
Query OK, 0 rows affected
Time: 0.016s
mysql root@(none):traceability>                                                                                                                                                                             
mysql root@(none):traceability>                                                                                                                                                                             
mysql root@(none):traceability>                                                                                                                                                                             
mysql root@(none):traceability>                                                                                                                                                                             
mysql root@(none):traceability> INSERT INTO `warning_ visualization`(`id`, `blacklist`, `credentials`, `process`, `device`, `monitoring`, `health`, `total`, `created_at`) VALUES (11, 3, 3, 3, 0, 0, 0, 6, 
                                '2019-07-01 00:00:00'); 
                                INSERT INTO `warning_ visualization`(`id`, `blacklist`, `credentials`, `process`, `device`, `monitoring`, `health`, `total`, `created_at`) VALUES (12, 3, 3, 3, 0, 0, 0, 6, 
                                '2019-07-02 00:00:00'); 
                                INSERT INTO `warning_ visualization`(`id`, `blacklist`, `credentials`, `process`, `device`, `monitoring`, `health`, `total`, `created_at`) VALUES (13, 3, 3, 3, 0, 0, 0, 6, 
                                '2019-07-03 00:00:00'); 
                                                                                                                                                                                                            
Query OK, 1 row affected
Time: 0.005s

Query OK, 1 row affected
Time: 0.002s

Query OK, 1 row affected
Time: 0.002s
mysql root@(none):traceability> exit                                                                                                                                                                        
Goodbye!
root@prdd:/opt/traceability_frontend# git pull
Username for 'https://gitee.com': guangming.wang@zaolabs.com
Password for 'https://guangming.wang@zaolabs.com@gitee.com': 
remote: Enumerating objects: 29, done.
remote: Counting objects: 100% (29/29), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 15 (delta 12), reused 0 (delta 0)
Unpacking objects: 100% (15/15), done.
From https://gitee.com/zaolabs/traceability_frontend
   60b6c62..c284a0c  develop    -> origin/develop
Updating 60b6c62..c284a0c
Fast-forward
 package-lock.json       | 3237 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------
 pages/add/device.vue    |    2 +-
 pages/add/logsheet.vue  |    2 +-
 pages/add/sample.vue    |    2 +-
 pages/add/vehicle.vue   |    2 +-
 pages/edit/device.vue   |    2 +-
 pages/edit/logsheet.vue |    2 +-
 pages/edit/vehicle.vue  |    2 +-
 pages/sample.vue        |    2 +-
 pages/vehicle.vue       |    2 +-
 10 files changed, 1714 insertions(+), 1541 deletions(-)
root@prdd:/opt/traceability_frontend# npm run build

> traceability@1.0.0 build /opt/traceability_frontend
> nuxt build


 WARN  vendor has been deprecated due to webpack4 optimization                                                                                                                                    21:27:01

ℹ Production build                                                                                                                                                                                21:27:03
✔ Builder initialized                                                                                                                                                                             21:27:03
✔ Nuxt files generated                                                                                                                                                                            21:27:03

✔ Client
  Compiled successfully in 33.94s


Hash: 6905cca35b9fddb7710c
Version: webpack 4.35.2
Time: 33944ms
Built at: 07/04/2019 9:27:38 PM
                         Asset      Size  Chunks                    Chunk Names
../server/client.manifest.json  51.9 KiB          [emitted]         
       004dab9d0167749393d8.js  4.69 KiB      20  [emitted]         pages/supplier
       0985f875aa7f2d681487.js  3.45 KiB       6  [emitted]         pages/add/user
       1011e182f4ec39dd76f4.js  5.01 KiB      14  [emitted]         pages/edit/vehicle
       1b2fe2db85c996018038.js  4.99 KiB      23  [emitted]         pages/vehicle
       23496137ffa02232d6ec.js    13 KiB       3  [emitted]         pages/add/logsheet
       2db5c86a0263523392b8.js  3.74 KiB      22  [emitted]         pages/user
       331fa44d016ccb42a2fd.js  4.47 KiB      27  [emitted]         pages/warn/health
       335558899301329d2e18.js  58.2 KiB       0  [emitted]         app
       382069004cb4da10ea39.js  4.82 KiB      28  [emitted]         pages/warn/list
       3cb4869ffba1f8bf67ed.js  4.22 KiB       8  [emitted]         pages/device
       460c0aeb36f369dae9a8.js  3.82 KiB       2  [emitted]         pages/add/device
       47f9b1e53947e3b7ccb3.js  4.66 KiB      19  [emitted]         pages/sample
       4c3a775ab212322ebc50.js   3.5 KiB      25  [emitted]         pages/warn/credentials
       4e37c7970ae040f8093d.js   8.2 KiB      15  [emitted]         pages/index
       505fccf3099e8c97856d.js   188 KiB       1  [emitted]         commons.app
       656e479ab1e9f79c8086.js  4.16 KiB       9  [emitted]         pages/edit/device
       660d4193fd5619e26645.js  4.64 KiB      30  [emitted]         pages/warn/productiveProcess
       7dc562ce2a992c545938.js  3.86 KiB      24  [emitted]         pages/warn/blacklist
       8c00174538ce9698223a.js  4.93 KiB       7  [emitted]         pages/add/vehicle
       8cf27e0a9193462913ce.js    11 KiB      12  [emitted]         pages/edit/supplier
       94523ba822ee16c9be1d.js  4.45 KiB       4  [emitted]         pages/add/sample
       94a75434d374d2910126.js  1.89 KiB      16  [emitted]         pages/list/logsheet
       9895edca2597bdb8984b.js   3.5 KiB      10  [emitted]         pages/edit/logsheet
                      LICENSES  1.49 KiB          [emitted]         
       b2208718cfa59dd1ce0e.js  2.96 KiB      31  [emitted]         runtime
       b76998b3a876e5663f7a.js   2.8 KiB      18  [emitted]         pages/logsheet
       be9231cb8881ab4c1892.js  1.65 MiB      32  [emitted]  [big]  vendors.app
       c22e2d7ff9c49b4a35dc.js  4.47 KiB      29  [emitted]         pages/warn/monitoring
       c2a4911ab7020a61d21e.js  3.59 KiB      13  [emitted]         pages/edit/user
       d88fc1cfb142780320c9.js  2.52 KiB      17  [emitted]         pages/login
       de0cd982ad82e01529e8.js  9.79 KiB       5  [emitted]         pages/add/supplier
       e05f6ea6d3d0ce6f794f.js  2.89 KiB      21  [emitted]         pages/support
       e09226d4998181089c26.js  4.64 KiB      11  [emitted]         pages/edit/sample
       f0b5a01547ba8a8ac9ce.js  4.47 KiB      26  [emitted]         pages/warn/device
            fonts/535877f.woff  27.5 KiB          [emitted]         
             fonts/732389d.ttf  54.6 KiB          [emitted]         
 + 1 hidden asset
Entrypoint app [big] = b2208718cfa59dd1ce0e.js 505fccf3099e8c97856d.js be9231cb8881ab4c1892.js 335558899301329d2e18.js

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  be9231cb8881ab4c1892.js (1.65 MiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (1000 KiB). This can impact web performance.
Entrypoints:
  app (1.89 MiB)
      b2208718cfa59dd1ce0e.js
      505fccf3099e8c97856d.js
      be9231cb8881ab4c1892.js
      335558899301329d2e18.js

ℹ Generating pages                                                                                                                                                                                21:27:38
✔ Generated /login                                                                                                                                                                                21:27:38
✔ Generated /logsheet                                                                                                                                                                             21:27:38
✔ Generated /supplier                                                                                                                                                                             21:27:38
✔ Generated /support                                                                                                                                                                              21:27:38
✔ Generated /user                                                                                                                                                                                 21:27:38
✔ Generated /device                                                                                                                                                                               21:27:38
✔ Generated /sample                                                                                                                                                                               21:27:38
✔ Generated /vehicle                                                                                                                                                                              21:27:38
✔ Generated /                                                                                                                                                                                     21:27:38
✔ Generated /add/device                                                                                                                                                                           21:27:38
✔ Generated /edit/device                                                                                                                                                                          21:27:38
✔ Generated /list/logsheet                                                                                                                                                                        21:27:38
✔ Generated /warn/blacklist                                                                                                                                                                       21:27:38
✔ Generated /add/logsheet                                                                                                                                                                         21:27:38
✔ Generated /add/sample                                                                                                                                                                           21:27:38
✔ Generated /add/supplier                                                                                                                                                                         21:27:38
✔ Generated /add/user                                                                                                                                                                             21:27:38
✔ Generated /add/vehicle                                                                                                                                                                          21:27:38
✔ Generated /edit/logsheet                                                                                                                                                                        21:27:38
✔ Generated /edit/sample                                                                                                                                                                          21:27:38
✔ Generated /edit/supplier                                                                                                                                                                        21:27:38
✔ Generated /edit/user                                                                                                                                                                            21:27:38
✔ Generated /edit/vehicle                                                                                                                                                                         21:27:38
✔ Generated /warn/credentials                                                                                                                                                                     21:27:38
✔ Generated /warn/device                                                                                                                                                                          21:27:38
✔ Generated /warn/health                                                                                                                                                                          21:27:38
✔ Generated /warn/list                                                                                                                                                                            21:27:38
✔ Generated /warn/monitoring                                                                                                                                                                      21:27:38
✔ Generated /warn/productiveProcess                                                                                                                                                               21:27:38
root@prdd:/opt/traceability_frontend# pm2 list
┌───────────────────────────────┬────┬─────────┬──────┬───────┬────────┬─────────┬────────┬──────┬───────────┬──────┬──────────┐
│ App name                      │ id │ version │ mode │ pid   │ status │ restart │ uptime │ cpu  │ mem       │ user │ watching │
├───────────────────────────────┼────┼─────────┼──────┼───────┼────────┼─────────┼────────┼──────┼───────────┼──────┼──────────┤
│ app_webview                   │ 5  │ N/A     │ fork │ 14180 │ online │ 0       │ 17m    │ 0.2% │ 41.6 MB   │ root │ disabled │
│ h5                            │ 4  │ N/A     │ fork │ 14179 │ online │ 0       │ 17m    │ 0.2% │ 41.3 MB   │ root │ disabled │
│ main                          │ 1  │ N/A     │ fork │ 14166 │ online │ 0       │ 17m    │ 0%   │ 37.0 MB   │ root │ disabled │
│ official                      │ 0  │ N/A     │ fork │ 14160 │ online │ 0       │ 17m    │ 0.2% │ 41.8 MB   │ root │ disabled │
│ resource_upload_linux         │ 3  │ N/A     │ fork │ 14640 │ online │ 1       │ 12m    │ 0%   │ 8.2 MB    │ root │ disabled │
│ trace_frontend                │ 2  │ N/A     │ fork │ 14736 │ online │ 1       │ 10m    │ 0.1% │ 40.8 MB   │ root │ disabled │
│ traceability_management_linux │ 6  │ N/A     │ fork │ 14316 │ online │ 0       │ 17m    │ 0%   │ 15.3 MB   │ root │ disabled │
└───────────────────────────────┴────┴─────────┴──────┴───────┴────────┴─────────┴────────┴──────┴───────────┴──────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app
root@prdd:/opt/traceability_frontend# pm2 reload 2
Use --update-env to update environment variables
[PM2] Applying action reloadProcessId on app [2](ids: 2)
[PM2] [trace_frontend](2) ✓
root@prdd:/opt/traceability_frontend# pm2 log 2
[TAILING] Tailing last 15 lines for [2] process (change the value with --lines option)
/opt/traceability_frontend/logs/app-err.log last 15 lines:
2|trace_fr | 
2|trace_fr | nuxt:proxy 21:10:11  ERROR  [HPM] Error occurred while trying to proxy request /v1/support?limit=1000000 from localhost:3008 to http://localhost:8080 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
2|trace_fr | 
2|trace_fr | 
2|trace_fr | nuxt:proxy 21:10:14  ERROR  [HPM] Error occurred while trying to proxy request /v1/support?limit=1000000 from localhost:3008 to http://localhost:8080 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
2|trace_fr | 
2|trace_fr | 
2|trace_fr | nuxt:proxy 21:10:17  ERROR  [HPM] Error occurred while trying to proxy request /v1/support?limit=1000000 from localhost:3008 to http://localhost:8080 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
2|trace_fr | 
2|trace_fr | 
2|trace_fr | 21:17:05  WARN  vendor has been deprecated due to webpack4 optimization
2|trace_fr | 
2|trace_fr | 
2|trace_fr | 21:27:46  WARN  vendor has been deprecated due to webpack4 optimization
2|trace_fr | 

/opt/traceability_frontend/logs/app-out.log last 15 lines:
2|trace_fr | 
2|trace_fr | 
2|trace_fr | > traceability@1.0.0 start /opt/traceability_frontend
2|trace_fr | > cross-env NODE_ENV=production node server/index.js
2|trace_fr | 
2|trace_fr | 
2|trace_fr | 21:17:06  READY  Server listening on http://localhost:3008
2|trace_fr | 
2|trace_fr | 
2|trace_fr | > traceability@1.0.0 start /opt/traceability_frontend
2|trace_fr | > cross-env NODE_ENV=production node server/index.js
2|trace_fr | 
2|trace_fr | 
2|trace_fr | 21:27:47  READY  Server listening on http://localhost:3008





修改表:
root@prdd:/opt/traceability_frontend# mycli -uroot
Password: 

root@prdd:/opt/traceability_frontend# mycli -uzaolabs
Password: 
(1045, u"Access denied for user 'zaolabs'@'localhost' (using password: YES)")
root@prdd:/opt/traceability_frontend# mycli -uzaolabs
Password: 
mysql 5.7.24-0ubuntu0.16.04.1
mycli 1.19.0
Chat: https://gitter.im/dbcli/mycli
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - Anonymous
mysql zaolabs@(none):(none)> show tables;                                                                                                                                                                   
(1046, u'No database selected')
mysql zaolabs@(none):(none)> use traceability;                                                                                                                                                              
You are now connected to database "traceability" as user "zaolabs"
Time: 0.000s
mysql zaolabs@(none):traceability> show tables;                                                                                                                                                             
+------------------------+
| Tables_in_traceability |
+------------------------+
| address                |
| api                    |
| capacity               |
| chain                  |
| department             |
| device                 |
| device_vendor          |
| duty                   |
| filiale                |
| group                  |
| h5_audit               |
| logsheet               |
| logsheet_frequency     |
| logsheet_record        |
| monitor_video          |
| question               |
| randomtest_note        |
| sample                 |
| scan_record            |
| supplier               |
| support                |
| user                   |
| vehicle                |
| version                |
| warning                |
+------------------------+
25 rows in set
Time: 0.010s
mysql zaolabs@(none):traceability> show create table warning;                                                                                                                                               
+---------+--------------------------------------------------------------+
| Table   | Create Table                                                 |
+---------+--------------------------------------------------------------+
| warning | CREATE TABLE `warning` (                                     |
|         |   `id` int(11) NOT NULL,                                     |
|         |   `title` varchar(45) DEFAULT NULL COMMENT '预警标题',       |
|         |   `content` varchar(45) DEFAULT NULL COMMENT '预警内容',     |
|         |   `warned_at` varchar(45) DEFAULT NULL COMMENT '预警时间',   |
|         |   `user_id` int(11) NOT NULL COMMENT '响应用户 ID',          |
|         |   `response_at` varchar(45) DEFAULT NULL COMMENT '响应时间', |
|         |   `status` varchar(45) DEFAULT NULL COMMENT '预警状态',      |
|         |   `remark` varchar(45) DEFAULT NULL COMMENT '备注',          |
|         |   `type` int(11) NOT NULL COMMENT '预警类型',                |
|         |   PRIMARY KEY (`id`)                                         |
|         | ) ENGINE=InnoDB DEFAU                                        |
+---------+--------------------------------------------------------------+
1 row in set
Time: 0.010s
mysql zaolabs@(none):traceability> alter table warning add unique `un_tile_content_index` (`title`,`content`);                                                                                              
You're about to run a destructive command.
Do you want to proceed? (y/n): y
Your call!
Query OK, 0 rows affected
Time: 0.111s
mysql zaolabs@(none):traceability> show create table warning;                                                                                                                                               
+---------+--------------------------------------------------------------+
| Table   | Create Table                                                 |
+---------+--------------------------------------------------------------+
| warning | CREATE TABLE `warning` (                                     |
|         |   `id` int(11) NOT NULL,                                     |
|         |   `title` varchar(45) DEFAULT NULL COMMENT '预警标题',       |
|         |   `content` varchar(45) DEFAULT NULL COMMENT '预警内容',     |
|         |   `warned_at` varchar(45) DEFAULT NULL COMMENT '预警时间',   |
|         |   `user_id` int(11) NOT NULL COMMENT '响应用户 ID',          |
|         |   `response_at` varchar(45) DEFAULT NULL COMMENT '响应时间', |
|         |   `status` varchar(45) DEFAULT NULL COMMENT '预警状态',      |
|         |   `remark` varchar(45) DEFAULT NULL COMMENT '备注',          |
|         |   `type` int(11) NOT NULL COMMENT '预警类型',                |
|         |   PRIMARY KEY (`id`),                                        |
|         |   UNIQUE KEY `un_til                                         |
+---------+--------------------------------------------------------------+
1 row in set
Time: 0.009s
mysql zaolabs@(none):traceability> show create table warning \G;                                                                                                                                            
***************************[ 1. row ]***************************
Table        | warning
Create Table | CREATE TABLE `warning` (
  `id` int(11) NOT NULL,
  `title` varchar(45) DEFAULT NULL COMMENT '<E9><A2><84><E8><AD><A6><E6><A0><87><E9><A2><98>',
  `content` varchar(45) DEFAULT NULL COMMENT '<E9><A2><84><E8><AD><A6><E5><86><85><E5><AE><B9>',
  `warned_at` varchar(45) DEFAULT NULL COMMENT '<E9><A2><84><E8><AD><A6><E6><97><B6><E9><97><B4>',
  `user_id` int(11) NOT NULL COMMENT '<E5><93><8D><E5><BA><94><E7><94><A8><E6><88><B7> ID',
  `response_at` varchar(45) DEFAULT NULL COMMENT '<E5><93><8D><E5><BA><94><E6><97><B6><E9><97><B4>',
  `status` varchar(45) DEFAULT NULL COMMENT '<E9><A2><84><E8><AD><A6><E7><8A><B6><E6><80><81>',
  `remark` varchar(45) DEFAULT NULL COMMENT '<E5><A4><87><E6><B3><A8>',
  `type` int(11) NOT NULL COMMENT '<E9><A2><84><E8><AD><A6><E7><B1><BB><E5><9E><8B>',
  PRIMARY KEY (`id`),
  UNIQUE KEY `un_tile_content_index` (`title`,`content`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set
Time: 0.005s
mysql zaolabs@(none):traceability>                                                                                                                                                                          
mysql zaolabs@(none):traceability> exit                                                                                                                                                                     
Goodbye!
root@prdd:/opt/traceability_frontend# exit
logout
Connection to 47.104.15.63 closed.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值