CodeAnalysis icon indicating copy to clipboard operation
CodeAnalysis copied to clipboard

环境变量配置以及启动服务报错,怎么解决?

Open Hedyt opened this issue 2 years ago • 17 comments

![image](https://user-images.githubusercontent.com/53597874/174022720-4573c92a-cf83-4c59-a97a-3282b6f888a5.png

请问 “使环境变量生效” 的这条命令,是在哪个路径下运行呢?

image

启动服务的时候出现报错,请问怎么解决呀? [root@BYVL-OPS-49-7 scripts]# bash deploy.sh start Check python version... Check celery command... ? celery could not be found

请帮忙解答下,谢谢

Hedyt avatar Jun 16 '22 08:06 Hedyt

启动服务时的报错,不确定是路径的原因 还是 未安装 celery 包的原因

Hedyt avatar Jun 16 '22 08:06 Hedyt

这里有将celery和gunicorn链接到/usr/local/bin/目录下么

Lingghh avatar Jun 16 '22 09:06 Lingghh

[root@BYVL-OPS-49-7 scripts]# whereis celery celery: /usr/local/bin/celery

做了

Hedyt avatar Jun 16 '22 10:06 Hedyt

[root@BYVL-OPS-49-7 scripts]# whereis gunicorn gunicorn: /usr/local/bin/gunicorn

Hedyt avatar Jun 16 '22 10:06 Hedyt

执行export PATH=/usr/local/bin:$PATH之后再执行bash deploy.sh start试试

Lingghh avatar Jun 16 '22 15:06 Lingghh

[root@BYVL-OPS-49-7 server]# pwd /CodeAnalysis/server [root@BYVL-OPS-49-7 server]# ln -s /usr/local/python3/bin/to/celery /usr/local/bin/celery [root@BYVL-OPS-49-7 server]# ln -s /usr/local/python3/bin/to/gunicorn /usr/local/bin/gunicorn [root@BYVL-OPS-49-7 server]# whereis celery celery: /usr/local/bin/celery [root@BYVL-OPS-49-7 server]# export PATH=/usr/local/bin:$PATH [root@BYVL-OPS-49-7 server]# bash ./scripts/deploy.sh start Check python version... Check celery command... ❌ celery could not be found

这是个我这边的操作流程,帮看下是有哪操作的不对嘛

Hedyt avatar Jun 17 '22 02:06 Hedyt

请问您部署的服务器是什么操作系统呢?

Lingghh avatar Jun 17 '22 08:06 Lingghh

Linux 操作系统 CentOS 7系统

Hedyt avatar Jun 17 '22 08:06 Hedyt

执行command -v celery有提示信息么

Lingghh avatar Jun 17 '22 08:06 Lingghh

没有提示 [root@BYVL-OPS-49-7 server]# command -v celery [root@BYVL-OPS-49-7 server]#

Hedyt avatar Jun 17 '22 08:06 Hedyt

了解,这里我们优化一下 先麻烦在本地注释一下 start_service.sh脚本的第14行和第21行,然后再执行一下

Lingghh avatar Jun 17 '22 15:06 Lingghh

还是有报错 [root@BYVL-OPS-49-7 server]# bash ./scripts/deploy.sh start Check python version... Check celery command... ❌ celery could not be found Check gunicorn command... ❌ gunicorn could not be found Start configs... start detect every dependcy for tca server... [TCAServerDependencyCheck] make sure command python exist [TCAServerDependencyCheck] make sure python has right version [TCAServerDependencyCheck] make sure every package is installed in right version [TCAServerDependencyCheck] make sure command celery exist ❌ command celery not found, please install celery then soft link to /usr/local/bin/celery Stop old server process... /CodeAnalysis/server/scripts/start_service.sh: line 54: killall: command not found /CodeAnalysis/server/scripts/start_service.sh: line 80: killall: command not found Stop old worker process Start main server /CodeAnalysis/server/scripts/start_service.sh: line 102: gunicorn: command not found Start analysis server /CodeAnalysis/server/scripts/start_service.sh: line 105: gunicorn: command not found Start file server /CodeAnalysis/server/scripts/start_service.sh: line 108: gunicorn: command not found Start login server /CodeAnalysis/server/scripts/start_service.sh: line 111: gunicorn: command not found Start scmproxy Start worker Start main celery worker Main celery worker log: /CodeAnalysis/server/projects/main/log/main_celery.log Start main celery beat Main celery beat log: /CodeAnalysis/server/projects/main/log/main_beat.log Start analysis celery worker Analysis celery worker log: /CodeAnalysis/server/projects/analysis/log/analysis_celery.log Server Log: /CodeAnalysis/server/logs start nginx ... nohup: redirecting stderr to stdout nohup: redirecting stderr to stdout nohup: failed to run command ‘celery’: No such file or directory nohup: redirecting stderr to stdout nohup: failed to run command ‘celery’: No such file or directory nohup: redirecting stderr to stdout nohup: failed to run command ‘celery’: No such file or directory [TCAServerHealthCheck] start detect status of every service ❌ nginx or service main failed, please reload nginx or view logs to locate the issue

可否提供远程支持呢

Hedyt avatar Jun 20 '22 03:06 Hedyt

这边是否方便用docker-compose部署呢? 看起来你的centos 7系统会缺失一些环境配置

Lingghh avatar Jun 20 '22 04:06 Lingghh

[root@BYVL-OPS-49-7 scripts]# bash deploy.sh start Check python version... Check celery command... Check gunicorn command... Start configs... start detect every dependcy for tca server... [TCAServerDependencyCheck] make sure command python exist [TCAServerDependencyCheck] make sure python has right version [TCAServerDependencyCheck] make sure every package is installed in right version [TCAServerDependencyCheck] make sure command celery exist [TCAServerDependencyCheck] make sure command gunicorn exist [TCAServerDependencyCheck] make sure enter neccessary configuration [TCAServerDependencyCheck] make sure mysql configuration is correct /CodeAnalysis/server/scripts/deploy_test.sh: line 100: mysqladmin: command not found ❌ your configuration for mysql is wrong, please check MYSQL_[HOST|PORT|USER|PASSWORD] in config.sh file

出现了这个报错。

我是这样配置的: #!/bin/bash

---- 需要关注的配置内容 ----

数据库配置,默认MySQL端口号为3306

export MYSQL_HOST='127.0.0.1' export MYSQL_PORT='3306' export MYSQL_USER='root' export MYSQL_PASSWORD='tca123'

是有什么地方配置的不对吗

Hedyt avatar Jun 28 '22 10:06 Hedyt

这里看起来是本地缺少了 mysqladmin 命令,请问本地的mysql是怎么安装的呢

Lingghh avatar Jun 30 '22 09:06 Lingghh

上面的问题应该是解决了。 怎么访问呢?我这边访问,只返回了“Weclome to TCA”,访问的端口是8000.

这个是启动客户端返回的结果 [root@BYVL-OPS-49-7 tca-deploy-source]# bash ./scripts/deploy.sh init -d ###################################### 脚本说明 ######################################

前端部署脚本

$1 action,为必传项,$2 其他参数,非必传项

部署web服务:bash ./scripts/deploy.sh init -d

###################################### 脚本说明 ###################################### % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 14 100 14 0 0 55 0 --:--:-- --:--:-- --:--:-- 56

============================前端配置说明============================ | 前端服务访问的后端地址: SERVER_ENV --- 127.0.0.1:8000 | 前端服务端口: INGRESS_PORT --- 80 | 前端服务SERVER_NAME: INGRESS_SERVER_NAME --- 123.127.46.142 | 注意: 前端服务SERVER_NAME默认通过命令 curl ifconfig.me 获取,用户可自行根据需要在config配置中进行调整 | 前端服务NGINX配置地址: NGINX_CONF_PATH --- /etc/nginx/conf.d | 前端服务资源部署地址: WEB_DEPLOY_PATH --- /usr/share/nginx/www | 前端服务日志地址: NGINX_LOG_PATH --- /var/log/nginx ========================end 前端配置说明 end======================== 将路径下的资源文件和前端nginx配置备份到 /usr/share/nginx/www_bak 下... 开始清理路径下的资源文件 /usr/share/nginx/www ... 开始清理前端nginx配置 ... 解压编译后文件到 /usr/share/nginx/www ... 初始化配置 framework ... index meta 配置 ... [INFO]:index.html RUNTIME is enabled [INFO]: change 404.html, unsupported-browser.html [INFO]: change index.html conf 配置迁移 ... framework 配置完毕 初始化配置web的nginx配置 ... 启动 nginx ...

Hedyt avatar Jun 30 '22 10:06 Hedyt

部署完web服务后,麻烦访问 80 端口试试

Lingghh avatar Jul 01 '22 03:07 Lingghh