This commit is contained in:
@@ -8,6 +8,12 @@
|
||||
|
||||
## 解决方法
|
||||
|
||||
**查看当前值**
|
||||
|
||||
```bash
|
||||
cat /proc/sys/fs/inotify/max_user_instances
|
||||
```
|
||||
|
||||
- 临时设置
|
||||
|
||||
```bash
|
||||
@@ -21,6 +27,20 @@
|
||||
sudo sysctl -p
|
||||
```
|
||||
|
||||
## 脚本计算推荐值
|
||||
|
||||
1. 下载脚本
|
||||
|
||||
```bash
|
||||
wget https://gitee.com/offends/Kubernetes/raw/main/File/Shell/inotify-check.sh
|
||||
```
|
||||
|
||||
2. 执行脚本
|
||||
|
||||
```bash
|
||||
bash inotify-check.sh
|
||||
```
|
||||
|
||||
### 参数含义
|
||||
|
||||
| 参数 | 说明 |
|
||||
@@ -40,3 +60,10 @@
|
||||
- 如果你的机器上有大量容器或日志文件:
|
||||
- 默认 `max_user_instances` 太小 → Promtail 会报错 `failed to create fsnotify watcher: too many open files`
|
||||
- 提升到 8192 或更高,可以允许单个用户(比如运行 Promtail 的 `root` 或容器内用户)创建更多 inotify watcher。
|
||||
|
||||
### 推荐值
|
||||
|
||||
- **一般桌面用户**:512-1024
|
||||
- **开发环境**:1024-2048
|
||||
- **运行多容器/监控服务**:2048-8192
|
||||
- **服务器/特殊情况**:16384 或更高
|
||||
|
||||
Reference in New Issue
Block a user