企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ## 安装前 1. 推荐开启服务器的时间同步如(chrony, ntpd) 以 chrony 为例 ``` // 安装 yum install chrony -y // 启动chrony systemctl start chrony systemctl enable chrony // 设置时区Asia/ Shanghai # timedatectl set-timezone Asia/Shanghai // 显示当前正在访问的时间源 # chronyc sources -v // 强制同步系统时间 # chronyc -a makestep ``` 2. 设置最大文件资源句柄 ``` // 永久修改 > cat /etc/security/limits.conf root soft nofile 65535 root hard nofile 65535 // 临时修改 > ulimit -n 65535 ``` 3. 优化网络内核参数 ``` > cat /etc/sysctl.conf net.core.somaxconn = 1024 net.core.netdev_max_backlog = 5000 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_wmem = 4096 12582912 16777216 net.ipv4.tcp_rmem = 4096 12582912 16777216 net.ipv4.tcp_max_syn_backlog = 8096 net.ipv4.tcp_slow_start_after_idle = 0 net.ipv4.tcp_tw_reuse = 1 net.ipv4.ip_local_port_range = 10240 65535 // 重载 > sysctl -p ``` ## 安装 > [官方教程](https://docs.fluentd.org/installation/install-by-rpm) ### rpm 安装 ``` # td-agent 4 $ curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent4.sh | sh ``` 启动守护进程 1. systemd ``` $ sudo systemctl {start|stop|status} td-agent.service ``` 2.init.d (centos-6) ``` sudo /etc/init.d/td-agent {start|stop|status} ``` 配置文件位置 `/etc/td-agent/td-agent.conf` ## 测试 ``` $ curl -X POST -d 'json={"json":"message"}' http://localhost:8888/debug.test $ tail -n 1 /var/log/td-agent/td-agent.log 2018-01-01 17:51:47 -0700 debug.test: {"json":"message"} ```