nginx warn an upstream response is buffered to a temporary file /usr/local/nginx/proxy_temp/3/47/0003311473 while reading upstream报错解决方法

今天发现nginx的log里面有报错,log如下

2019/06/10 19:01:46 [warn] 8294#0: *231715335 an upstream response is buffered to a temporary file /usr/local/nginx/proxy_temp/3/47/0003311473 while reading upstream, client: 144.123.15.66, server: oa.xxx.com.cn, request: "GET /sys/attachment/sys_att_main/sysAttMain.do?method=readDownload&fdId=16b406e3861578ee83d15344deb88105&open=1 HTTP/1.1", upstream: "http://10.254.2.16:80/sys/attachment/sys_att_main/sysAttMain.do?method=readDownload&fdId=16b406e3861578ee83d15344deb88105&open=1", host: "oa.xxx.com.cn", referrer: "http://oa.xxx.com.cn/km/review/km_review_main/kmReviewMain.do?method=view&fdId=16b4063ca15ddfca4ed8e3747d09968f"
2019/06/10 19:01:52 [warn] 8292#0: *231712177 an upstream response is buffered to a temporary file /usr/local/nginx/proxy_temp/4/47/0003311474 while reading upstream, client: 115.173.28.199, server: aqhcrm.xxx.com.cn, request: "GET /weixinfile/bonuspic/ebd192724baf49e782eb89a9f1b78e3f.png HTTP/1.1", upstream: "http://10.254.2.21:80/weixinfile/bonuspic/ebd192724baf49e782eb89a9f1b78e3f.png", host: "aqhcrm.xxx.com.cn", referrer: "http://aqhcrm.xxx.com.cn/modules/weixin/bonusSelf.html"

从error日志来看是nginx某一块的buffer设置的太小,(包含response header和response body)导致response结果不得不临时写到文件中,解决办法:
在nginx的http段,或location段增加如下参数,参数值根据实际应用需求调整,

proxy_buffering on;
client_max_body_size 500M;
client_body_buffer_size 500M;
proxy_buffer_size 5120k;
proxy_buffers 2560 5120k;
proxy_busy_buffers_size 5120k;
proxy_temp_file_write_size 5120k;

最后重启nginx报错日志消失;

炎炎夏日

夏天到了,看天气预报咸阳的温度比上海还热,不过北方的天气是早晚温差大,中午很热,但是早晚还好;

人是一个惰性动物,冬天怕冷,夏天怕热;

行动比想法更难,做比想难,坚持!行动起来。

---阅读剩余部分---

Flask使用pymysql后出现Warning:1366的解决办法

Flask项目中,运行python models.py时报错如下:

C:\Users\ice\.virtualenvs\blog-edDN3LWE\lib\site-packages\pymysql\cursors.py:170: Warning: (1366, "Incorrect string value: '\\xD6\\xD0\\xB9\\xFA\\xB1\\xEA...' for column 'VARIABLE_VALU
E' at row 485")
  result = self._query(query)

原因是MySQL5.7数据库使用的是utf8mb4编码,使用pymysql会报1366警告,但是数据还是能执行操作,解决方法更换为mysql-connector-python

pip install mysql-connector

models.py里面使用:

import mysql.connector
app.config["SQLALCHEMY_DATABASE_URI"] = "mysql+mysqlconnector://账号:密码@localhost/appname"

然后执行就不会报错了^o^

博客更换域名

以前的域名是unixso.com 目前已更换为unixso.com 更短,mhl这个只是名字里面第一个字母,比较好记,这次会一直使用下去;

看山不是山

很多时候,在看一些事情的时候,表面上看起来貌似很简单,实际上很深入的了解后,确实不简单;特别是在技术方面和项目方面;

越深入越发现自己无知,很多东西不了解;

可能你的了解的只是冰山一角;

iceberg.jpg

SQL Server 2014 创建只读用户

SQLServer系列创建用户基本相似,此处以2014版本为例,创建bpm_r用户为只读用户,仅可读取H3Cloud数据库权限,操作方法如下:
1、打开【Microsoft SQLServer Management Studio】,用管理员账户登录。
2、找到【安全性】,打开,可以看到【登录名】,在上面右键,选择【新建登录名】。
3、在【常规】选项中,输入登录名,选择身份验证方式。这里我选用了【SQL Server 身份验证】同时,勾掉【强制实施密码策略】,输入账号、密码等信息,如下图:
1.png
4、在右侧的【用户映射】选项卡中,【映射到此登录名的用户】选择该用户可以操作的数据库。针对每一个数据库,在下方【数据库角色成员身份】中,选择【db_datareader】和【public】
如下图:
2.png
确定后即可使用bpm_r用户登录数据库,数据库上最好做下IP策略设置;

Ubuntu 18.04更换国内镜像源提高安装更新速度

Ubuntu18.04默认安装完以后镜像是官方的,国内更新速度太慢,更新为阿里云或中科大等其他国内源,速度会明显提高,操作方法如下:
备份原文件:

cp /etc/apt/sources.list /etc/apt/sources.list_bak

将/etc/apt/sources.list文件内容替换为如下:(任意其一即可)
阿里云镜像源

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

网易镜像源

deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

清华镜像源

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

中科大镜像源

deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

更新系统及软件

sudo apt-get update

sudo apt-get upgrade

后面在安装软件速度就很快了~.

192 MB的VPS上安装ss服务基于Ubuntu16.04

在内存只有192MB小鸡vps上安装ss服务,基于ubuntu16.04精简版,安装脚本命令如下:

apt-get update

pip install -U pip

pip3 install --upgrade pip

pip3 install shadowsocks

pip install --upgrade shadowsocks

pip3 install --upgrade shadowsocks
     
cat <<EOF>> /etc/shadowsocks.json
{
    "server":"vps ipadder",
    "local_address":"127.0.0.1",
    "local_port":8888,
    "port_password":{
         "9001":"password",
         "9002":"password"
    },
    "timeout":600,
    "method":"aes-256-cfb",
    "fast_open": false
}
EOF

/usr/local/bin/ssserver -c /etc/shadowsocks.json >> /ss.log 2>&1 &

---阅读剩余部分---

pip升级后出现"from pip import main" line 9问题的解决方法

在Ubuntu或CentOS中,升级了pip版本,再次使用pip 安装相关的包的时候就出现以下错误

Traceback (most recent call last): 
File “/usr/bin/pip”, line 9, in <module>
from pip import main

解决:pip文件在usr/bin目录下,cd进去,进行以下修改

from pip import main
if __name__ == '__main__':
    sys.exit(main())

换成下面的三行

from pip import __main__
if __name__ == '__main__':
    sys.exit(__main__._main())

然后问题就解决了;
pip3也是一样;

使用国内镜像源 提高pip安装更新速度

不论是使用 pip,还是 Pipenv、Poetry等工具,安装 Python 包的时候会默认从官方的 PyPI 源下载文件,速度比较慢。国内的一些公司和机构提供了 PyPI 镜像源(mirror source),你可以设置让这些工具从国内的镜像源安装 Python 包,以便提高下载速度。

官方 PyPI 源的 URL 为 https://pypi.org/simple (旧的 URL 为 https://pypi.python.org/simple

pip更换临时设置可以通过 -i 选项:

pip install -i https://mirrors.aliyun.com/pypi/simple/ flask

永久更换:
Windows系统:
首先在window的文件夹窗口输入 : %APPDATA%



---阅读剩余部分---

MySQL子查询参数说明

MySQL查询的五种子句

where子句(条件查询):按照“条件表达式”指定的条件进行查询。

group by子句(分组):按照“属性名”指定的字段进行分组。group by子句通常和count()、sum()等聚合函数一起使用。

having子句(筛选):有group by才能having子句,只有满足“条件表达式”中指定的条件的才能够输出。

order by子句(排序):按照“属性名”指定的字段进行排序。排序方式由“asc”和“desc”两个参数指出,默认是按照“asc”来排序,即升序。

limit(限制结果集)。

---阅读剩余部分---

Nginx 414 Request-URI Too Large报错解决方法

症状:前台客户端发送大量请求或发送的数据包太大的时候,nginx会报nginx 414 Request-URI Too Large错误,如下图
1.png
检查Log里面显示有大量报错

2019/04/09 15:03:32 [error] 21197#0: *90489 client intended to send too large body: 1470779 bytes, client: 124.74.25.254, server: zt-test.xxx.cn, request: "POST /cinema/salesman/save HTTP/1.1", host: "zt-test.xxx.cn:8080", referrer: "http://zt-test.xxx.cn:8080/index"
2019/04/09 15:22:37 [error] 21200#0: *90745 client intended to send too large body: 1376065 bytes, client: 114.86.94.252, server: zt-test.xxx.cn, request: "POST /cinema/salesman/save HTTP/1.1", host: "zt-test.xxx.cn:8080", referrer: "http://zt-test.xxx.cn:8080/index"
2019/04/10 09:08:46 [error] 21200#0: *91741 client intended to send too large body: 1470779 bytes, client: 124.74.25.254, server: zt-test.xxx.cn, request: "POST /cinema/salesman/save HTTP/1.1", host: "zt-test.xxx.cn:8080", referrer: "http://zt-test.xxx.cn:8080/index


---阅读剩余部分---

AWS镜像AMI制作

先在本地安装Oracle VM VirtualBox,安装好虚拟机(调整优化系统各个参数)此处不再赘述,IP设置为自动获取,最后关机导出,格式为“开放式虚拟化格式 1.0”,如下图,导出完以后上传到S3存储上;

---阅读剩余部分---

Django2.x删除表后重建

Django框架中删除表,正确的方法步骤如下:
1、进入数据库中,如MySQL中删除表

drop table tablename;

2、注释django中对应的Model和引用该Model对应的代码,然后执行:

python manage.py makemigrations   
python manage.py migrate --fake

d1.jpg
3、去掉刚才的注释重新同步数据即可。

python manage.py makemigrations   
python manage.py migrate

Oracle 错误号解释大全

ORA-00001: 违反唯一约束条件 (.)
ORA-00017: 请求会话以设置跟踪事件
ORA-00018: 超出最大会话数
ORA-00019: 超出最大会话许可数
ORA-00020: 超出最大进程数 ()
ORA-00021: 会话附属于其它某些进程;无法转换会话
ORA-00022: 无效的会话 ID;访问被拒绝
ORA-00023: 会话引用进程私用内存;无法分离会话








---阅读剩余部分---

最新

分类

归档

评论

其它