Skip to content

Commit 68de5f9

Browse files
committed
update readme
1 parent c64e6f9 commit 68de5f9

File tree

5 files changed

+297
-330
lines changed

5 files changed

+297
-330
lines changed

Linux/linux-basic.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## <a name="Linux_base_knowledge"/> Linux 基础知识
2+
+ 检查网卡是否正确工作
3+
1. 检查系统路由表信息是否正确
4+
1. [Linux route命令详解和使用示例](http://www.jb51.net/LINUXjishu/152385.html)
5+
1. 案例介绍:
6+
```
7+
www@ubuntu1:/var/log$ route
8+
Kernel IP routing table
9+
Destination Gateway Genmask Flags Metric Ref Use Iface
10+
default 122.11.11.161 0.0.0.0 UG 0 0 0 em1
11+
10.10.101.0 * 255.255.255.0 U 0 0 0 em2
12+
122.11.11.160 * 255.255.255.224 U 0 0 0 em1
13+
```
14+
+ 默认路由为:`122.11.11.161`,绑定在`em1` 网卡上
15+
+ 而`10.10.101.0` 段的IP仅供局域网主机之间共享数据,没对外连接访问权限,因而外界是没办法通过`10`段网络连接到服务器的
16+
+ 如果需要`10.10.101.0` 段可以让外网放完的,则需要删除`122.11.11.161` 的默认路由,需要在`em2`网卡上添加`10`段的默认路由即可
17+
+ 具体步骤:
18+
```
19+
www@ubuntu1:/var/log$ route delete defaul
20+
www@ubuntu1:/var/log$ route add defaul gw 10.10.101.1
21+
```
22+
+ 此时外界就可以通过`ssh [email protected]`连接到服务器了
23+
+ find 命令
24+
+ 查找超出7天前的flv的文件进行删除:
25+
+ 命令:
26+
```Bash
27+
find ./ -mindepth 1 -maxdepth 3 -type f -name "*.flv" -mmin +10080 | xargs rm -rf
28+
```
29+
+ `-type f` 按类型查找
30+
+ `-mmin +10080` 7天之前的文件
31+
+ xargs与-exec功能类似,` find ~ -type f | xargs ls -l `
32+
+ -r 就是向下递归,不管有多少级目录,一并删除
33+
+ -f 就是直接强行删除,不作任何提示的意思
34+
+ 查找当前目录下.p文件中,最近30分钟内修改过的文件:
35+
+ `find . -name '*.p' -type f -mmin -30`
36+
+ 查找当前目录下.phtml文件中,最近30分钟内修改过的文件,的详细de情况加上ls:
37+
+ `find . -name '*.phtml' -type f -mmin -30 -ls`
38+
+ 查找当前目录下,最近1天内修改过的常规文件:`find . -type f -mtime -1`
39+
+ 查找当前目录下,最近1天前(2天内)修改过的常规文件:`find . -type f -mtime +1`

Lua-Script/lua-basic.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,4 +483,28 @@
483483
- [x] table.concat()
484484
- [x] table.insert()
485485
- [x] table.maxn()
486-
- [x] table.concat()
486+
- [x] table.concat()
487+
+ Lua 实现简单封装
488+
+ man.lua
489+
```Lua
490+
local _name = "Tinywan"
491+
local man = {}
492+
493+
function man.GetName()
494+
return _name
495+
end
496+
497+
function man.SetName(name)
498+
_name = name
499+
end
500+
501+
return man
502+
```
503+
+ 测试封装,test.lua
504+
505+
```Lua
506+
local man = require('man')
507+
print("The man name is "..man.GetName())
508+
man.SetName("Phalcon")
509+
print("The man name is "..man.GetName())
510+
```

Nginx/nginx-basic.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,18 @@
3232
+ Nginx 变量漫谈(四)
3333
+ [Nginx的11个Phases](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/nginx-phases.md)
3434
+ [Nginx 陷阱和常见错误](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/nginx-1-config.md)
35-
+ [Nginx 高并发系统内核优化](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/nginx-parameter-config.md)
35+
+ [Nginx 高并发系统内核优化](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/nginx-parameter-config.md)
36+
+ [nginx 并发数问题思考:worker_connections,worker_processes与 max clients](http://liuqunying.blog.51cto.com/3984207/1420556?utm_source=tuicool)
37+
+ 从用户的角度,http 1.1协议下,由于浏览器默认使用两个并发连接,因此计算方法:
38+
1. nginx作为http服务器的时候:
39+
`max_clients = worker_processes * worker_connections/2`
40+
1. nginx作为反向代理服务器的时候:
41+
`max_clients = worker_processes * worker_connections/4`
42+
+ 从一般建立连接的角度,客户并发连接为1:
43+
1. nginx作为http服务器的时候:
44+
`max_clients = worker_processes * worker_connections`
45+
1. nginx作为反向代理服务器的时候:
46+
`max_clients = worker_processes * worker_connections/2`
47+
+ nginx做反向代理时,和客户端之间保持一个连接,和后端服务器保持一个连接
48+
+ clients与用户数
49+
同一时间的clients(客户端数)和用户数还是有区别的,当一个用户请求发送一个连接时这两个是相等的,但是当一个用户默认发送多个连接请求的时候,clients数就是用户数*默认发送的连接并发数了。

0 commit comments

Comments
 (0)