tip

uwsgi 处理记录

August 1, 2023
tip, problem, uwsgi
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 # 守护进程一定要注释掉(关键) 查看性能数据 # 安装 uwsgitop 查看 uwsgi stats写入位置 查看 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. ...

Qt/PySide

January 18, 2022
tip, qt, pyside

绘制界面和使用 # 安装Qt本体后可以使用Design绘制图形化界面.而后保存为xxx.ui文件. 转换为py # 注意版本 pyside6-uic xxx.ui -o ui_xxx.py 不过信号槽就不要在Design中去标了, 放在py中手动创建和管理目前看来更为直观方便.

安装问题

January 15, 2022
tip, install
install, npm, nodejs

记录一些安装问题 # Debian 使用 apt-add-repository(ppa) # sudo apt update sudo apt install software-properties-common FreeBSD桌面 # 换源 pkg install xorg xfce echo ‘dbus_enable=“YES”’ » /etc/rc.conf echo “/usr/local/etc/xdg/xfce4/xinitrc” > ~/.xinitrc startx 登录界面 # pkg install slim slim-themes echo ‘slim_enable=“YES”’ » /etc/rc.conf vbox(没测试) # pkg install virtualbox-ose-additions 向/etc/rc.conf写入 vboxguest_enable="YES" vboxservice_enable="YES" 仅供参考看这里 因为vbox显卡太弱安装了vmware后就一直没用回过vbox,我还没测试过 vmware # pkg install open-vm-tools xf86-video-vmware xf86-input-vmmouse 继续向/etc/rc.conf中写入 hald_enable="YES" moused_enable="YES" # vmware_guest_vmblock_enable="YES" # vmware_guest_vmhgfs_enable="YES" # vmware_guest_vmmemctl_enable="YES" # vmware_guest_vmxnet_enable="YES" # vmware_guest_enable="YES" 下面注释掉的是因为在测试中如果打开的话会有各种问题…. ...

gRpc使用小记

May 24, 2021
tip, problem, gRpc
win, rpc

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

Nginx高可用

May 9, 2021
tip, web, learning
nginx, keepalived

Keepalived+Nginx实现高可用 # Nginx 关键字 # IO多路复用epoll(IO复用) 轻量,插件: Nginx仅保留了HTTP CPU亲和: 每个worker进程固定在一个CPU Nginx配置 # 代理 # 动静分离 # 动态页面和静态页面交给不同的服务器来解析 负载均衡 # upstream balanceServer { server 10.1.22.33:12345; server 10.1.22.34:12345; server 10.1.22.35:12345; } server { server_name fe.server.com; listen 80; location /api { proxy_pass http://balanceServer; } } 机制 # 默认: 轮询, 单机卡顿, 影响分配在这台服务器下的用户 默认: 权重轮询, 宕机Nginx会自动剔除出队列, ip_hash-来源IP分配分配给同个服务器 fair: 根据相应时间均衡分配, 默认不支持. 需安装upstream_fair, url_hash类ip_hash同样需要安装Nginx的hash软件包. Keepalived 配置 # 粘贴自: 这里 概览 # VIP IP 主机名 Nginx端口 默认主从 192. ...

OpenCV

April 22, 2021
tip, 换源

问题(libSM.so.6 缺失) # 运行opencv的代码时,报以下错误: # Traceback (most recent call last): File "data_generator.py", line 24, in <module> import cv2 File "/usr/local/lib/python3.5/dist-packages/cv2/__init__.py", line 3, in <module> from .cv2 import * ImportError: libSM.so.6: cannot open shared object file: No such file or directory 解决 # 原因是缺少共享文件库,解决办法如下: 安装apt-file $ apt-get update $ apt-get install apt-file $ apt-file update 寻找依赖库 $ apt-file search libSM.so.6 libsm6: /usr/lib/x86_64-linux-gnu/libSM.so.6 libsm6: /usr/lib/x86_64-linux-gnu/libSM.so.6.0.1 根据提示,安装合适的依赖库 $ apt-get install libsm6 其余文件缺失类似, 即可解决问题。

各个软件换源

April 22, 2021
tip, 换源

在国内用原源都会很慢, 所以总结一下各个软件(?吧)换源方法. Qt # 使用Maintain管理kit时,可以在Settings中设置Repositories,设置地址可从Qt Downloads页面查询. apt # 可解决版本升级时的问题,即使用了国内源,最后一个文件不知道为什么还是从国外拉取… # sudo touch /etc/apt/apt.conf sudo vim /etc/apt/apt.conf -> Acquire::http::Proxy “http://127.0.0.1:8001”; FreeBSD # mkdir -p /usr/local/etc/pkg/repos vim /usr/local/etc/pkg/repos/bjtu.conf bjtu: { url: "pkg+http://mirror.bjtu.edu.cn/reverse/freebsd-pkg/${ABI}/quarterly", mirror_type: "srv", signature_type: "none", fingerprints: "/usr/share/keys/pkg", enabled: yes } FreeBSD: { enabled: no } pkg update Qt # 源 # 中国科学技术大学:http://mirrors.ustc.edu.cn/qtproject/ 清华大学:https://mirrors.tuna.tsinghua.edu.cn/qt/ 北京理工大学:http://mirror.bit.edu.cn/qtproject/ 中国互联网络信息中心:https://mirrors.cnnic.cn/qt/ Python Pip # pip install --index https://pypi.mirrors.ustc.edu.cn/simple/ dlib(numpy等包名) 源 # 阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 豆瓣(douban) http://pypi. ...

tips Of Debuggers

January 10, 2019
tip, debug, learning
debuger, pdb, gdb, learning

Clang && lldb # 听说clang+lldb >= gcc + gdb, 所以一试: lldb基本命令 # 与GDB相同 break (b) - 设置断点,也就是程序暂停的地方 run (r) - 启动目标程序,如果遇到断点则暂停 step (s) - 进入下一条指令中的函数内部 backtrace (bt) - 显示当前的有效函数 frame (f) - 默认显示当前栈的内容,可以通过 frame arg 进入特定的 frame(用作输出本地变量) next (n) - 运行当前箭头指向行 continue (c) - 继续运行程序直到遇到断点。 clang hello.c -g -o hello lldb hello # lldb b main run n p str 还有颜色 😂 可视效果确实提高了不少 而且这四个工具可以混用,也蛮好. GDB # First and foremost, you will need to compile your program with the flag “-g” (for debug) to run it via GDB. ...

Tips of debuggers

January 10, 2019
tip, debug, learning
debuger, pdb, gdb, learning

Clang && lldb # 听说clang+lldb >= gcc + gdb, 所以一试: lldb基本命令 # 与GDB相同 break (b) - 设置断点,也就是程序暂停的地方 run (r) - 启动目标程序,如果遇到断点则暂停 step (s) - 进入下一条指令中的函数内部 backtrace (bt) - 显示当前的有效函数 frame (f) - 默认显示当前栈的内容,可以通过 frame arg 进入特定的 frame(用作输出本地变量) next (n) - 运行当前箭头指向行 continue (c) - 继续运行程序直到遇到断点。 clang hello.c -g -o hello lldb hello # lldb b main run n p str 还有颜色 😂 可视效果确实提高了不少 而且这四个工具可以混用,也蛮好. GDB # First and foremost, you will need to compile your program with the flag “-g” (for debug) to run it via GDB. ...