分类 cmd 下的文章

批量更新数据报错, 包括额外套一层也会报错, 网上找了圈没有找到答案

update tb1
,(select id from tb1 where id in (123)) daa
set tb1.value=1
where tb1.id=daa.id

按我下面的写法即可解决

update tb1
,(select id from tb1 where id in (123) limit 9999999) daa
set tb1.value=1
where tb1.id=daa.id

  • 转发内容替换(不支持长链接内容替换)
# 关闭gzip
gunzip on;
gzip_disable ".";

# 转发内容全局替换
proxy_redirect off; 
sub_filter_once     off; # off为多次替换,默认值为on仅仅替换一次
sub_filter_types *; # 替换的content-type类型
sub_filter "hometree-ts.oss-cn-shanghai.aliyuncs.com" "hometree-ts.oss-accelerate.aliyuncs.com";
sub_filter "oss-ts.jiayuanshu.net" "hometree-ts.oss-accelerate.aliyuncs.com";

sub_filter "hometree.oss-cn-shanghai.aliyuncs.com" "hometree.oss-accelerate.aliyuncs.com";
sub_filter "oss.jiayuanshu.net" "hometree.oss-accelerate.aliyuncs.com";
sub_filter "hometree.oss.jiayuanshu.net" "hometree.oss-accelerate.aliyuncs.com";


sub_filter 指令
sub_filter string replacement。将string替换成replacement,不区分大小写。
sub_filter_last_modified on | off。默认:off,防止缓存。是否在Response header中写入Last-Modified,控制缓存。
sub_filter_once on | off。默认: on,只执行一次。sub_filter指令是执行一次,还是重复执行。
sub_filter_types mime-type …。默认: text/html。指定类型的MINE TYPE,如果所有类型,则使用:*。
  • 自动转发且自动帮助登录
location /online_api1/ {
    proxy_set_header Authorization 'Bearer eyJ0eXJ9.eyJpc3MiiA';
    proxy_pass https://api.test.cn/; 
}
  • 微服务2种配置方式
 # 访问 /*/aaa 实际请求 http://localhost:9501/aaa
location /abcd/ {
            proxy_pass http://localhost:9501/;
}
location ~ /abcd(/|$)(.*) { 
    proxy_pass http://localhost:9501/$2;
}

# 访问 /*/aaa 实际请求 http://localhost:9501/aaa 
location ~ /[a-z_0-9]+(/|$)(.*) { # 为列出来的都转发到该接口 
    if ($query_string = ''){
        proxy_pass http://t.wuloves.com/$2;
    }
    proxy_pass http://t.wuloves.com/$2?$query_string;
}
  • location 携带参数
location ^~ /abc {
    proxy_set_header    Host $host;
    proxy_set_header    X-Real-IP  $remote_addr;
    proxy_pass http://127.0.0.1:8081/;
}
  • 路径转发
location /callback/ {
    proxy_pass http://www.baidu.com/;
}
# 网上有人说https协议不能访问, 测试实际访问是http, 配置中转发到https转发正常, 同样实际测试转发的域名是无法将域名替代为ip通过https访问的
# 当前被访问的为https未测试
location /https/ {
    proxy_pass https://www.baidu.com/;
}

# 重点,转发websocket需要的设置
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection upgrade;

  • 创建文件 auto_start_nginx.bat 并放入启动目录
taskkill /f /im nginx.exe
d:
cd "D:\s\nginx-1.18.0\"
start "" "nginx.exe"
  • 创建文件 hide_php_cgi.bat 并放入启动目录
set ws=WScript.CreateObject("WScript.Shell")
ws.Run "D:\s\php\php-cgi.exe -b 127.0.0.1:9000",0
  • 重启nginx
taskkill /f /im nginx.exe
nginx.exe

  • 目录结构
.
├── Dockerfile 
│   └── config
│        └── swoole_tracker.ini
├── swoole_tracker74.so
├── push_docker.sh 编译并推送镜像
└── run_dockerfile.sh 编译并运行
  • Dockerfile
FROM hyperf/hyperf:7.4-alpine-v3.13-swoole
# FROM hyperf/hyperf:8.0-alpine-v3.13-swoole

# COPY config /var/www/config
# RUN rm /etc/php7/php.ini -f && ln -s /var/www/config/php.ini /etc/php7/php.ini
# ADD swoole_tracker74.so /usr/lib/php7/modules/swoole_tracker.so
# COPY config/swoole_tracker.ini /etc/php7/conf.d/98_swoole_tracker.ini

COPY composer.phar ./
# RUN wget https://www.wuloves.com/d/composer.phar && chmod u+x composer.phar \
# RUN wget https://wuloves.oss-cn-shanghai.aliyuncs.com/d/composer.phar \
RUN chmod u+x composer.phar \
    && cp composer.phar /usr/local/bin/composer \
    && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer \
    && composer -v

RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.13/community/ gnu-libiconv=1.15-r3
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
  • push_docker.sh
#!/bin/bash
pwd
docker login --username=root --password=123456 registry.cn-shanghai.aliyuncs.com
docker build -t hyperf:v20220406 .
docker tag h4 registry.cn-shanghai.aliyuncs.com/wuloves/hyperf-report:1.0
docker push registry.cn-shanghai.aliyuncs.com/wuloves/hyperf-report:1.0
  • run_dockerfile.sh
#!/bin/bash
pwd
# 构建镜像
docker build -t h4 .
# 启动镜像
docker run -v /data:/data -p 9501:9501 -it h4
  • swoole_tracker.ini
[swoole_tracker]
extension=swoole_tracker.so

;打开总开关
apm.enable=0
;采样率 例如:100%
apm.sampling_rate=100

;开启内存泄漏检测时添加 默认0 关闭状态
apm.enable_memcheck=1

;Leak检测开关
apm.enable_malloc_hook=1

  • Row 224 was cut by GROUP_CONCAT()
# 查询当前全局配置, 尝试修改全局配置, 如果没有全局配置权限, 可以修改当前连接的配置
SELECT @@global.group_concat_max_len;
SET GLOBAL group_concat_max_len=102400;
SET group_concat_max_len=1024;