uwsgi 处理记录

日志输出到终端#

uwsgi.ini文件中配置

log-master = true
; logto=/var/log/uwsgi.log 同时这行不能有

启动命令: uwsgi /opt/disk2/var/www/scancenter/3rd/conf/uwsgi-docker/uwsgi.ini --log-master

隔一段时间卡死,重启不能#

当作为纯后端API使用时, 使用 http-socket 不使用 http

使用supervisor管理uwsgi#

#daemonize=/var/log/uwsgi8011.log # 守护进程一定要注释掉(关键)

查看性能数据#

  1. 安装 uwsgitop
  2. 查看 uwsgi stats写入位置
  3. 查看
pip install uwsgitop
cat /opt/trunk/textcheck/3rd/uwsgi/config.ini | grep stats
# > stats=/var/run/uwsgi/uwsgi.status
uwsgitop /var/run/uwsgi/uwsgi.status
# > uwsgi-2.0.19.1 - Wed Oct 18 18:13:48 2023 - req: 113 - RPS: 0 - lq: 0 - tx: 75.1K

node: app-58d8477f4-26fzb - cwd: /app - uid: 0 - gid: 0 - masterpid: 8 WID % PID REQ RPS EXC SIG STATUS AVG RSS VSZ TX ReSpwn HC RunT LastSpwn 1 28.3 132942 32 0 0 0 idle 19161ms 0 0 15.2K 1 0 155394.03 17:34:42 2 28.3 132950 32 0 0 0 idle 1781ms 0 0 20.1K 1 0 126123.093 17:34:42 3 22.1 132958 25 0 0 0 idle 5982ms 0 0 16.9K 1 0 127199.778 17:34:42 4 21.2 132963 24 0 0 0 idle 15274ms 0 0 22.8K 1 0 144018.093 17:34:42

gRpc使用小记

gRpc

gRpc HelloWorld#

helloWorld#

quickstart

protoc --go_out=. --go_opt=paths=source_relative \
    --go-grpc_out=. --go-grpc_opt=paths=source_relative \
    helloworld/helloworld.proto

MacOS下问题#

  • 原本protobuf中没有mac的gen-go和gen-go-grpc,所以需要额外运行安装.
  • 除了使用brew用go get应该也是可以的,就是有路径问题,所以还是使用brew吧
brew install protobuf
brew install protoc-gen-go
brew install protoc-gen-go-grpc

解决问题记录笔记

问题们

各种一键问题解决方案#

Windows下Git问题#

  • Linux没啥问题,但在Win下报checkout失败,路径问题
git config core.protectNTFS false

docker - supervisord 禁用日志文件或使用 logfile=/dev/stdout#

from: https://www.coder.work/article/100835 标签 docker supervisord

[supervisord]
nodaemon=true
logfile=/dev/stdout
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor

当我这样做时,这个主管会崩溃,因为它无法在/dev/stdout 中寻找

如何禁用 supervisord 在我的 docker 容器中创建任何日志文件?

最佳答案

对于主主管,nodaemon 将导致日志转到 stdout

[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0

然后将每个托管进程的日志发送到标准输出文件描述符/dev/fd/1

[program:x]
command=echo test
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true

或者,如果您希望将 stderr 保留在不同的流上:

[program:x]
command=echo test
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/2
stderr_logfile_maxbytes=0

关于docker - supervisord 禁用日志文件或使用 logfile=/dev/stdout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45645758/

docker中执行sed报Device or resource busy错误的处理原因及方式 转载#

kuSorZ 博主文章分类:Linux 文章标签: docker | sed 文章分类: Docker 原文出处: https://www.cnblogs.com/xuxinkun/p/7116737.html错误现象

在docker容器中想要修改/etc/resolv.conf中的namesever,使用sed命令进行执行时遇到错误:

/ # sed -i ’s/192.168.1.1/192.168.1.254/g’ /etc/resolv.conf sed: can’t move ‘/etc/resolv.conf73UqmG’ to ‘/etc/resolv.conf’: Device or resource busy