标签:cdn too lse via bzip2 iptables tac 代码 tom
安装环境系统:CentOS 7.4
yum update
yum -y install epel*
yum -y install bzip2
我这里下载的是 7.1版本的源代码 最新的已经有8.0版本
http://archive.apache.org/dist/trafficserver/trafficserver-7.1.4.tar.bz2
需要访问这个url里面有链接 用wget 下载
bzip2 -d .tar.bz2 //将文件解压成.tar
tar -xf **.tar //解包
下载完成后不要着急编译 先优化下系统 如果是美国机器做视频站用的话 最好做个锐速
执行下面这些命令
cat << ‘EOT‘ >> /etc/sysctl.conf
fs.file-max=655350
net.ipv4.tcp_max_tw_buckets = 300000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_max_syn_backlog = 65536
net.core.netdev_max_backlog = 32768
net.core.somaxconn = 32768
net.core.rmem_default=98304
net.core.wmem_default=98304
net.core.rmem_max=2097152
net.core.wmem_max=2097152
net.ipv4.tcp_rmem=4096 98304 2097152
net.ipv4.tcp_wmem=4096 98304 2097152
net.ipv4.tcp_low_latency=1
net.ipv4.tcp_slow_start_after_idle=0
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_fin_timeout = 20
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_syncookies = 0
#net.ipv4.tcp_tw_len = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.ip_local_port_range = 1024 65000
EOT
sysctl -p /etc/sysctl.conf
cat << ‘EOT‘ >> /etc/security/limits.d/nofile.conf
* soft nofile 655350
* hard nofile 655350
EOT
cat <<EOF>>/etc/rc.local
#open files
ulimit -HSn 655350
#stack size
ulimit -s 655350
EOF
yum install -y gcc gcc-c++ pkgconfig pcre-devel tcl-devel expat-devel openssl-devel perl-ExtUtils-MakeMaker bzip2
yum install -y libcap libcap-devel hwloc hwloc-devel ncurses-devel libcurl-devel libunwind libunwind-devel autoconf automake libtool
yum -y install git gcc gcc-c++ autoconf automake libtool pkgconfig pcre-devel tcl-devel expat-devel openssl-devel xz-devel boost-devel perl-ExtUtils-MakeMaker libcap libcap-devel hwloc hwloc-devel libunwind libunwind-devel curl curl-devel ncurses ncurses-devel
yum install centos-release-scl -y
yum install devtoolset-6-gcc* -y
scl enable devtoolset-6 bash
groupadd ats
useradd -g ats ats
进入ATS目录开始编译 编译安装需要一会时间 请耐心等待
cd /root/trafficserver-7.1.4
./configure --prefix=/ --with-user=ats --with-group=ats --enable-experimental-plugins
make -j $(nproc)
make install
trafficserver start
1.1.启动
2.trafficserver start
3.2.关闭
4.trafficserver stop
5.3.重启
6.trafficserver restart
7.4.重载配置文件(很多情况下好像都没有生效)
8.traffic_ctl config reload
9.5.监控ats的状况 类似于top命令
10.traffic_top
11.6.清理所有缓存
12.traffic_server -Cclear
vi add_header.config
add-header Access-Control-Allow-Origin *
vi plugin.config
header_rewrite.so add_header.config
yum install -y ntpdate
/sbin/ntpdate cn.pool.ntp.org #同步时间
tzselect
timedatectl set-timezone Asia/Shanghai #设置时区
复制root目录下的脚本到新服务器 (查看权限是否相同,以及属主属组)
修改iD配置文件auto.sh autolog.sh
server=6 数字为卧龙后台播放列表竖列,没有空着的就联系主管新增一列,从左往右数新增在第几列id就为几
复制线上配置文件/etc/trafficserver下所以配置文件到新增服务器
修改vi records.config下
##############################################################################
CONFIG proxy.config.http.insert_request_via_str INT 0
CONFIG proxy.config.http.insert_response_via_str INT 2
CONFIG proxy.config.http.response_server_str STRING wlzy_cdn(BGP)/1.0
CONFIG proxy.config.http.response_via_str STRING wlzy_cdn(BGP)
##############################################################################
vim /etc/trafficserver/storage.conf
/data/ats/cache 750G
mkdir -p /data/ats/cache
chown -R ats.ats /data
创建分区
fdisk /dev/sdb
n
p
直接回车全给
w
mkfs.ext4 /dev/sdc
mount /dev/sda1 /data
vim /etc/fstab
/dev/sdc1 /data ext4 defaults 0 0
将线上的crontab 拷贝到新的服务器上
配置好后重启 trafficserver restart 查看tail diags.log日志报错信息
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel -y
tar zxf Python-3.6.2.tgz
cd Python-3.6.2
./configure --prefix=/usr/local/
make
make altinstall
ln -s /usr/local/bin/python3.6 /usr/bin/python3
ln -s /usr/local/bin/pip3.6 /usr/bin/pip
安装zabbix zabbix部署在前面博客
将该服务添加到zabbix server
重启ATS,然后查看一下分区大小。发现使用飙升。说明配置正确了。能正确读写缓存文件了,然后查看日志,确认一下是否还有其他错误
mkdir /web/log
执行./autolog.sh脚本
telnet ip 80
telnet ip 443
添加白名单增加服务器之后吧服务器重新添加进去
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
yum install iptables-services #安装
vi /etc/sysconfig/iptables #编辑防火墙配置文件
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 443 -j ACCEPT
systemctl restart iptables.service #最后重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动
标签:cdn too lse via bzip2 iptables tac 代码 tom
原文地址:https://blog.51cto.com/13555423/2371917