cfanzp 发布于 收录于 nginxnginx web负载均衡配置 下载nginx http://nginx.org/en/download.html 1 wget http://nginx.org/download/nginx-1.20.2.tar.gz 安装nginx 参考: https://www.cnblogs.com/-wei/p/15219624.html 1 2 3 4 5 ./configure --prefix=/opt/nginx 或 ./configure --prefix=/opt/nginx --with-http_ssl_module make make install 报错 ./configure: error: the HTTP rewrite module requires the PCRE library 1 yum -y install pcre-devel ./configure: error: the HTTP gzip module requires the zlib library. 1 yum -y install zlib-devel ./configure: error: SSL modules require the OpenSSL library. 1 yum -y install openssl openssl-devel nginx限制请求数据包大小 1 client_max_body_size 1000m; 负载均衡配置 参考: https://www.
cfanzp 发布于 收录于 nginxnginx配置笔记 基本概念 惊群现象:一个网路连接到来,多个睡眠的进程被同时叫醒,但只有一个进程能获得链接,这样会影响系统性能。 全局块 nginx服务器用户组 nginx进程pid 日志存放路径 配置文件引入 允许生成worker process数 event块 配置影响nginx服务器或与用户的网络连接。包括: 每个进程的最大连接数 选取那种事件驱动模型处理连接请求 是否允许同时接受多个网路连接 开启多个网络连接序列化等。 http块 可以嵌套多个server 配置代理,缓存,日志定义等绝大多数功能和第三方模块的配置。 文件引入 mime-type定义 日志定义 是否使用sendfile传输文件 连接超时时间 单连接请求数 server块 配置虚拟主机的相关参数,一个http中可以有多个server块 location 块 配置请求的路由,以及各种页面的请求情况 nginx文件结构 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ... #全局块 events { #events块 ... } http #http块 { ... #http全局块 server #server块 { .
skynet中使用uuid库 最近在使用之前一位同学写的uuid库时发现了uuid在不通的skynet虚拟机中可能会产生相同的值的现象,这里记录一下。产生的原因是,这2个虚拟机是在服务启动的时候创建的,间隔时间很短,随机种子估计是一样的。后面产生的随机序列都是一样的。
uuid库初始化种子 相同时间初始化种子,后续产生的随机数是相同的,随机种子初始化代码如下:
1 2 local uuid = require "uuid" uuid.seed() -- 初始化uuid种子 不同lua虚拟机中使用uuid可能生成相同的uuid,下面就是2个skynet服务在相同时间创建并初始化uuid种子的例子,不难看出,2个服务轮询接受请求,依次产生的uuid是相同的。
1 2 3 4 [:0000001a] [2022-07-29 11:36:36.561] [W] [login_web_agent1] service/login/platform/account_login.lua:111: req: 40a1bbf6-2e44-4b4a-cb9d-7a383472184b [:0000001b] [2022-07-29 11:36:44.059] [W] [login_web_agent2] service/login/platform/account_login.lua:111: req: 40a1bbf6-2e44-4b4a-cb9d-7a383472184b [:0000001a] [2022-07-29 11:36:55.069] [W] [login_web_agent1] service/login/platform/account_login.lua:111: req: bc96f82f-c94c-4398-c346-e956a92dcc11 [:0000001b] [2022-07-29 11:41:13.213] [W] [login_web_agent2] service/login/platform/account_login.lua:111: req: bc96f82f-c94c-4398-c346-e956a92dcc11 总结 这个uuid库的使用需要保证uuid的使用是在一个虚拟机内。如果想uuid不重复,又要保证唯一性,可以创建一个专有的skynet虚拟机来提供uuid的分配工作。
cfanzp 发布于 收录于 lualuacheck luacheck 是一个lua代码的静态检查工具,可以用来发现lua代码中的一些缺陷,规范lua代码的书写。lua是一们解释型语言,很多错误只有在运行时才会暴露出来。借助静态检查工具能够方便我们在前期就发现一些低级错误并及时修正。
安装 ubuntu 1 sudo apt install lua-check centos 1 yum install luarocks 这里使用luarocks来安装luacheck,安装过程中可能遇到报错的问题。
安装报错信息: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 root@mybonline1 mybonline]# luarocks install luacheck Installing https://luarocks.org/luacheck-0.25.0-1.src.rock... Using https://luarocks.org/luacheck-0.25.0-1.src.rock... switching to 'build' mode Missing dependencies for luacheck: luafilesystem >= 1.6.3 argparse >= 0.6.0 Using https://luarocks.org/luafilesystem-1.8.0-1.src.rock... switching to 'build' mode gcc -O2 -fPIC -I/usr/include -c src/lfs.c -o src/lfs.o src/lfs.
cfanzp 发布于 收录于 linuxlinux-计算器命令bc 基本用法 查看版本 1 2 3 $ bc -v bc 1.07.1 Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc. 查看帮助 1 2 3 4 5 6 7 8 9 $ bc -h usage: bc [options] [file ...] -h --help print this usage and exit -i --interactive force interactive mode -l --mathlib use the predefined math routines -q --quiet don't print initial banner -s --standard non-standard bc constructs are errors -w --warn warn about non-standard bc constructs -v --version print version information and exit 支持的运算 +:加 -:减 *:乘 /:除 ^:指数 %:求余数 sqrt:开方 ibase:输入进制 obase:输出进制 ;要计算多个结果用分号分隔 scale:小数部分位数 1.
cfanzp 发布于 收录于 linuxxfreerdp 使用举例 远程192.168.2.3这台机器并挂载/home/admin/share目录 1 xfreerdp +clipboard /w:1920 /h:1050 /u:Administrator /p:admin1234567890 /v:192.168.2.3:3389 /drive:share,/home/admin/share 使用帮助 xfreerdp –help 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 [zp@zp-pc dev]$ xfreerdp --help FreeRDP - A Free Remote Desktop Protocol Implementation See www.