日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

高性能Linux架构实战 [高俊峰] 笔记摘要

發(fā)布時間:2024/1/1 linux 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 高性能Linux架构实战 [高俊峰] 笔记摘要 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
一 Linux服務器安全與運維1.賬戶和登錄安全可刪除的默認無用用戶:adm lp sync shutdown halt news uucp operator games gopher可刪除的默認無用組:adm lp uucp games dip pppusers popusers slipusers關(guān)閉不需要的服務:anacron auditd autofs avahi-daemon avahi-dnsconfd bluetooth cupspeed firstboot gpm haldaemon hidd ip6tables ipsec isdn lpd mcstrans messagebus netfs nfs nfslock nscd pcscd portmap readahead_early restorecond rpcgssd rpcidmapd rstatd sendmail setroubleshoot yppasswdd ypserv.[chkconfig --level 345 anacron off]將SSH客戶端生成的密鑰放置服務端 啟用Publickey認證mkdir /home/test/.sshchmod 700 /home/test/.sshssh-keygen -i -f test.pub >> /root/.ssh/authorized_key2vim /etc/ssh/sshd_configProtocol 2? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?#僅使用SSH2認證PubkeyAuthentication yes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #啟用PublicKey認證AuthorizedKeysFile .ssh/authorized_key2? ? ? ? #PublicKey文件路徑PasswordAuthentication no? ? ? ? ? ? ? ? ? ? ? ? ? ? ?#不使用口令認證/etc/rc.d/init.d/sshd restart開放普通用戶單文件特權(quán)? ?(使用sudo 訪問無權(quán)限的文件 輸入密碼后獲得5分鐘的訪問券)vim /etc/sudoerstest01 ALL = /bin/more /etc/shadow#無需密碼的方式test01 ALL = NOPASSWD: /etc/init.d/nagios restart?#普通用戶提權(quán)為超級用戶并不需要密碼test01 ALL=(ALL) NOPASSWD: ALL系統(tǒng)登錄歡迎信息/etc/issue /etc/issue.net /etc/redhat-release /etc/motdvim /etc/ssh/sshd_config?Banner /etc/issue.net禁止Ctrl+Alt+Del 關(guān)機centos5.xvim /etc/inittabca::ctrlaltdel:/sbin/shutdown -t3 -r now? ? ? ? ? ?#將此行注釋telinit qcentos6.xvim /init/control-alt-delete.confexec /sbin/shutdown -r now "Control-Alt-Delete pressed"? ?#注釋此行禁止telnet方式認證登錄vim /etc/ssh/sshd_config修改shell歷史記錄長度vim /etc/bashrcHISTFILESIZE=10000HISTSIZE=10000HISTTIMEFORMAT='%F %T'export HISTTIMEFORMAT
/etc/profile#historyUSER_IP= `who -u am i 2>/dev/null |awk '{print $NF}'|sed -e 's/[()]//g'`HISTDIR=/usr/share/.historyif [ -z $USER_IP]thenUSER_IP=`hostname`fi
if [ ! -d $HISTDIR ]thenmkdir -p $HISTDIRchmod 777 $HISTDIRfi
if [ ! -d $HISTDIR/${LOGNAME} ]then?mkdir -p $HISTDIR/${LOGNAME}chmod 300 $HISTDIR/${LOGNAME}fiexport HISTSIZE=10000DT=`date +%Y%m%d_%H%M%s`export HISTFILE="$HISTDIR/${LOGNAME}/${USER_IP}.history.$DY"export HISTTIMEFORMAT="{%Y.%m.%d %H:%M:%S}"chmod 600 $HISTDIR/${LOGNAME}/*.history* 2>/dev/null-------------------------------------------------------------文件權(quán)限檢查任何用戶都有寫權(quán)限find / -type f -perm -2 -o -perm -20 |xargs ls -alfind / -type d -perm -2 -o -perm -20 |xargs ls -al含有s位的程序find / -type f -perm -4000 -o -perm -2000 -print |xargs ls -al查詢含有suid和sgid文件find / -user root -perm -2000 -print -exec md5sum {} \;find / -user root -perm -4000 -print -exec md5sum {} \;查詢沒有屬主的文件find / -nouser -o nogroup?/tmp單獨分區(qū)時安全的掛載方式LABEL=/tmp? ? /tmp? ? ext4? ? rw,nosuid,noexec,nodev? ? 0 0/tmp是目錄的安全掛載方式 [啟動loopback文件系統(tǒng)]dd if=/dev/zero of=/dev/tmpfs bs=1M count=10000mke2fs -j /dev/tmpfscp -av /tmp /tmp.oldmount -o loop,noexec,nosuid,rw /dev/tmpfs /tmpchmod 1777 /tmpmv -f /tmp.old/* /tmprm -rf /tmp.oldvim /etc/fstab?/dev/tmpfs /tmp ext4 loop,nosuid,noexec,rw 0 0/dev/shm 安全掛載方式vim /etc/fstabtmpfs /dev/shm tmpfs defaults,nosuid,noexec,rw 0 0
文件級rootkit檢查文件完整性:Tripwire aide后門檢測工具 chkrootkit避免chkrootkit依賴的工具被污染提前備份一份完整所需工具至指定目錄mkdir /usr/share/.commandscp `which --skip-alias awk cut echo find egrep id head ls netstat ps strings sed uname` /user/share/.commands?chkrootkit -p /usr/share/.commands/檢測工具2 RKHunter? ? ? ? ? ??#./installer.sh --layout default --installrkhunter -crkhunter --check --skip-keypress? ? ?#靜默檢查09 3 *** root rkhunter --check --cronjobpidof?2.網(wǎng)絡(luò)安全運維Ntop:嗅探網(wǎng)絡(luò)數(shù)據(jù)包類型,分析區(qū)分數(shù)據(jù)流量Ntopng?iperf:網(wǎng)絡(luò)性能評估工具iperf3 -c 192.168.12.168iperf3 -c 192.168.12.168 -t 20 -i 5iperf3 -c 192.168.12.168 -i 10 -n 5000000000? #每隔十秒發(fā)送5G的數(shù)據(jù)iperf3 -c 192.168.12.168 -F test.tar.gz -i 5 -t 20 -f Miperf3 -c 192.168.12.168 -u -b 100M -f M -i 3nmap:網(wǎng)絡(luò)發(fā)現(xiàn)工具nmap 39.106.125.107nmap -T4 -A -v?39.106.125.107nmap -sn -PE -PS22,80 -PU53 www.baidu.comPE:發(fā)送ICMP echo 報文? ? ?PS:發(fā)送TCP SYN/ACK的形式偵探主機? ? PU:以UDP形式偵探nmap -sU -sS -F www.myblogsite.top? ?nmap -O --osscan-guess 192.168.3.1-2543.數(shù)據(jù)安全DRDByum -y install kmod-drbd83 drbd83modprobe drbdlsmod|grep -i drbdmodprobe -l|grep -i drbddd創(chuàng)建空數(shù)據(jù): dd if=/dev/zero of=/mnt/testblack.tmp bs=10M count=20數(shù)據(jù)恢復extundelete:? Linux常用恢復工具:debugfs R-Liunx ext3grep extundelete等.extundelete與ext3grep比較常用,兩款工具原理較為相似.前者功能更強大.通過分析文件系統(tǒng)的日志,解析出所有文件的indoe信息,從而可以恢復Linux下主流的ext3 ext4文件系統(tǒng)下被誤刪除的文件.而ext3grep僅支持ext3文件系統(tǒng),此外在恢復速度上前者要更快,是通過掃描inode和數(shù)據(jù)恢復同時進行,且支持單文件 單目錄 inode恢復 block恢復與完整磁盤恢復.而ext3grep略顯笨拙需要掃描所有inode信息然后開始恢復數(shù)據(jù),速度上相對比較慢且不支持目錄 時間恢復等.前置安裝e2fsprogs與e2fsprogs-libs1.誤操作刪除需要立即將分區(qū)卸載.2.extundelete /dev/sdc1 --inode 23.extundelete /dev/sdc1 --restore-file passwd? ?#單文件恢復4.extundelete /dev/sdc1 --restore-directory /ganglia-3.4.0? #單目錄恢復5.extundelete /dev/sdc1 --restore-all? #全部文件恢復6.extundelete --after 1379146740 --restore-all /dev/sdc1? #恢復一小時內(nèi)文件? ?當前 date +%s-36004.Linux系統(tǒng)運維故障排查思路Linux系統(tǒng)常見無法啟動a.文件系統(tǒng)受損 [ext3 ext4文件系統(tǒng)都是具備日志記錄功能的日志文件系統(tǒng),并且可以進行簡單的容錯與糾錯.日志文件系統(tǒng)并不是將數(shù)據(jù)實時寫入到磁盤,而是定期批量寫入,但文件系統(tǒng)的所有讀寫操作都會實時記錄到日志文件中,當系統(tǒng)發(fā)生掉電等錯誤導致數(shù)據(jù)沒有寫入磁盤時可以通過日志文件的記錄回滾發(fā)生故障的讀寫操作,從而保證數(shù)據(jù)和文件系統(tǒng)的一致性,但是由于實際環(huán)境復雜多樣導致文件系統(tǒng)不能每一次都可以成功自我修復,這是就需要運維人員手動介入修復.]掉電開機提示:? /dev/sda6 contains a file system with errors,check forced/dev/sda6:UNEXPECTED INCONSISTENCY;RUN fsck MANUALLY(or type Control-D to continue):give root password for maintenance輸入root密碼后進入修復模式,使用fsck命令修復.fsck.ext3 -y /dev/sda6? ? ? ? ? [無法恢復的數(shù)據(jù)會存放在文件系統(tǒng)lost+found目錄中]? ? (fsck -A -y)若忘記root密碼centos6.x1.引導參數(shù)中增加? init=/bin/bash 載入系統(tǒng).2.mount -o remount,rw /? ? ? ? ? ? ?#重掛根3.passwd? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?#修改密碼4.重啟輸入root密碼繼續(xù)修復.centos7.x1.引導參數(shù)中增加??rd.break console=tty0? 載入系統(tǒng)2.mount remount,rw /sysroot? ? ? ? #重掛根3.chroot /sysroot? ? ? ? ? ? ? ? ? ? ? ? ? ? #切換根4.passwd? ? ? ? ??5.touch /.autorelabel? ? ? ? ? ? ? ? ? ? ? ? ??6.exit7.rebootb.系統(tǒng)文件配置不當或/etc/fstab文件丟失開機提示: starting system logger1.開機使用引導介質(zhì)進入救援模式? [linux rescue]2.e2label 可查看每個分區(qū)對應的掛載點?3.查找出原系統(tǒng)的跟分區(qū)目錄查找出對應分區(qū) 如 /dev/sda34.創(chuàng)建一個目錄 /rescue_tmp 將原根掛載至此? ? mkdir /rescue_tmp ;mount /dev/sda3 /rescue_tmp5.vim /rescue_tmp/etc/fstab6.恢復完成后重啟系統(tǒng).c.Linux內(nèi)核丟失或崩潰d.引導程序出錯e.硬件故障f.無響應分析系統(tǒng)硬件問題: SCSI卡 主板 RAID卡 HBA卡 網(wǎng)卡 硬盤等硬件設(shè)備導致,通過更換硬件解決外圍硬件問題: 主要為網(wǎng)絡(luò)問題導致.網(wǎng)絡(luò)設(shè)備 網(wǎng)絡(luò)參數(shù)等方面查找軟件問題: 系統(tǒng)內(nèi)核bug 應用軟件bug 驅(qū)動程序bug等? 通過升級內(nèi)核 修復程序bug 更新驅(qū)動程序解決系統(tǒng)設(shè)置問題: 防火墻配置 開機啟動不正確等.iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT?iptables -A OUTPUT -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
5.常見故障案例su 切換普通用戶時報錯.報錯提示: su: warning: cannot change directory to /home/oracle: Permission deniedsu: /bin/bash: Permission denied?排查思路:
  • 用戶目錄權(quán)限存在問題ls -ld /home/oracle?
  • su? ?程序權(quán)限存在問題ll /bin/su
  • 程序依賴的共享庫問題ldd /bin/su?
  • SELinux問題grep "SELINUX" /etc/selinux/config
  • 系統(tǒng)根分區(qū)問題檢查剩余容量檢查根分區(qū)權(quán)限
創(chuàng)建文件提示: Cannot make directory: file:/www/data/html? ? ? ? ? [Read-only file system]原因比較多,可能是文件系統(tǒng)數(shù)據(jù)塊出現(xiàn)不一致導致,也可能是磁盤故障導致.可以嘗試fsck修復1.卸載無法寫入的磁盤.2.若有占用則查詢占用端口? fuser -m /dev/sdb1? ? 查找出占用進程3.停止進城后卸載目錄4.進行修復? ?fsck -V -a /dev/sdb15.重新掛會
操作大量文件時遇到 Argument list too long? ? ?getconf ARG_MAX? 控制傳遞參數(shù)手動分批刪除find傳遞刪除shell腳本循環(huán)刪除重新編譯linux內(nèi)核? include/liunx/binfmts.h文件 #define MAX_ARG_PAGES 32? ?將32改為64或128.重新編譯inode消耗殆盡?dumpe2fs -h /dev/sda3|grep 'Inode count'
文件刪除后空間不釋放:? 文件存放分為數(shù)據(jù)部分和指針部分,指針部分位于文件系統(tǒng)的meta-data中,將數(shù)據(jù)清除后指針從meta-data中被清除.將數(shù)據(jù)對應的指針清除后空間隨之釋放.進程占用不斷的寫數(shù)據(jù)導致
Too many open files?ulimit -n? ? ? ? ? ? ? [/etc/security/limits.conf]www soft nofile 65535www hard nofile 65535內(nèi)核文件大小限制進程數(shù)據(jù)塊大小限制shell進程創(chuàng)建文件大小限制可加鎖內(nèi)存大小限制常駐內(nèi)存集的大小限制打開文件句柄數(shù)限制分配堆棧的最大大小限制CPU占用時間限制用戶最大可用的進程數(shù)shell進程所能使用的最大虛擬內(nèi)存限制
No speace left on device:mod_rewrite:could not create rewrite_log_lock Configyration Failed??信號量占盡.? ipcs -s |grep nobody|perl -e 'while (<STDIN> { @a=split(/\s+/); print `ipcrmsem $a[1]`})'

6.輕量級運維利器pssh pdsh mussh并行ssh運維工具pssh? ?parallel-ssh? 支持文件并行復制/遠程并行執(zhí)行命令/殺死遠程主機進程等&? 需要保證本地主機與管理服務器之間單向信任&? Python版本大于2.4&? 附帶5個主程序?ssh(pssh)? ? ? ? ? 遠程主機并行運行命令scp(pscp)? ? ? ? ? 復制文件至遠程多臺主機rsync(prsync)? ? 使用rsync協(xié)議將文件從本地同步到遠程多臺主機nuke(pnuke)? ? ?在遠程主機并行killall某進程slurp(pslurp)? ? ?將文件從遠程主機復制到本地查看user002 003的時間pssh -H opsuser@user002.bestbook.com:9529 -P datepssh -H user003.bestbook.com?-i date批量管理列表? /etc/pssh/hosts批量下發(fā)命令獲取運行時間?pssh -i -O "StrictHostKeyChecking=no" -h /etc/pssh/hosts "uptime"? ? ? ? -O?"StrictHostKeyChecking=no"? 讓遠程主機自動接受本地hostkey解壓文件passh -i -h /etc/pssh/hosts "tar -xzvf test.zip"連接指定端口passh -i -x "-l opsuser" "-p 9529" -h /etc/pssh/hosts -o /etc/pssh/info "uptime;name-a"? ? ? ? ? ? ? ? ? ? ? ? ??本地文件推送給批量遠端pscp -h /etc/pssh/hosts /etc/ssh/ssh_config /tmppscp -h /etc/pssh/hosts -r /etc/httpd/conf /tmp??本地拉取遠端文件pslurp -h /etc/pssh/hosts -L /home/opsuser/test > /home/opsuser/gmond.conf gmond1.confpslurp -h /etc/pssh/hosts -r -L /home/opsuser/test > /home/opsuser/gmond gmond1本地文件同步到遠程主機 prsync -h /etc/pssh/hosts -l opsuser -a -r /etc/httpd /tmp prsync -h /etc/pssh/hosts -l opsuser -az -r /var/log/httpd /tmp? ? ? ? ? ? ? ?#壓縮傳輸 殺死遠端進程 punke -h /etc/pssh/hosts httpd
分布式運維工具pdsh? parallel distributed shell? 適用于大批量服務器配置/部署/文件復制/運維等操作 &? 需要保證本地主機與管理服務器之間的單向信任 &? 默認rsh方式? 支持ssh mrsh qsh mqsh krb4 xcpu 等多種rcmd模塊 &? --with-ssh? --with-dshgroups? --with-machines? --with-dshgroups &? 傳輸文件時 本地與遠端都必須安裝pdcp 批量統(tǒng)計信息 pdsh -w ssh:192.168.16.[1-3]? "uname -n" pdsh -w ssh:user00[1-5] -x user003 "uptime" pdsh -w ssh:user00[10-31],/15/ "uptime" 文件批量調(diào)用 /etc/pdsh/machines pdsh -R ssh -a uptime pdsh -R ssh -g userhosts uptime pdsh -R ssh -a -X userhosts uptume 交互模式 pdsh -R ssh -w user001 文件傳輸 pdcp -R ssh -g userhosts /home/opsuser/mysqldb.tar.gz /home/opsuser pdcp -R ssh -w userhosts -r /home/opsuser/webdata /home/opsuser
多主機ssh封裝mussh? MUltihost SSH Wrapper &? 需要保證本地主機與管理服務器之間的單向信任 批量命令: mussh -h opsuser@user01 opsuser@user02 -c uptime 文件批量命令? ? ? ?/home/opsuser/myhosts mussh -H myhosts -l opsuser -c uptime 本地腳本遠端執(zhí)行 mussh -o "port=22" -H myhosts -s /usr/bin/python -C "/home/opsuser/checkos.py"

7.分布式監(jiān)控 Ganglia HPC(高性能計算集群) 采集CPU 內(nèi)存 硬盤使用率 I/O負載 網(wǎng)絡(luò)流量等情況匯總到gmetad守護進程下,使用rrdtool存儲數(shù)據(jù).以曲線方式展示 &? gmond: ganglia monitoring daemon 守護檢測進程默認監(jiān)聽8649 &? gmetad:ganglia meta daemon 數(shù)據(jù)匯聚守護進程,將數(shù)據(jù)存儲至RRD引擎中 &? webfrontend:從gmetad中讀取RRD數(shù)據(jù)通過rrdtool生成圖表 gmetric -n disk_used -v 40 -t int32 -u '% test' -d 50 -s '8.8.8.8:cloud1'
8.高性能Nginx服務器 HTTP/IMAP/POP3/SMTP代理服務器 --with-http_stub_status_module? ? #開啟nginx status功能 監(jiān)控狀態(tài) --with-http_gzip_static_module? ? ?#開啟Gzip壓縮功能 select? ? ? ? ? 標準工作模式1 poll? ? ? ? ? ? ?標準工作模式2 kqueque? ? ?高效工作模式1 epoll? ? ? ? ? ?高效工作模式2 rtsig? ? ? ? ? ?? /dev/poll max_client=worker_processes * worker_connections(默認1024)? ?#ulimit -n 65536 sendfile? on; tcp_nopush on ; tco_nodelay on; 開啟ngin運行狀態(tài) localtion /NginxStatus { stub_status? ? ? ? ? ? ? ? ?on; access_log? ? ? ? ? ? ? ? ? logs/NginxStatus.log; auth_basic? ? ? ? ? ? ? ? ? "NginxStatus"; auth_basic_user_file? ?../htpasswd; } htpasswd -C htpassswd password 信號處理: QUIT:? 15? ?處理完當前請求關(guān)閉進程 HUP:? ? ? ? ?重載配置,關(guān)閉原由進程開啟新進程,不中斷請求 USR1:? ? ? ? Nginx日志切割 USR2:? ? ? ? 平滑升級 WINCH:? ? ?從容關(guān)閉 rewrite重寫 來自www.taob.com的請求至www.tb.com? service { service_name? www.taob.com; rewirte ^/(.*)$? http://www.tb.com/$1?permanent;? ?#301 redirect 302 } 基于核心變量$host實現(xiàn)重定向 service { server_name? www.tb.com?www.taob.com; if ($host != 'www.tb.com') { rewirte ^/(.*)$ http://www.tb.com/$1?permanent; } } 禁止訪問特定資源 location ~* \.(txt|doc)$ { root /data/www/wwwroot; deny all; } Nginx內(nèi)置變量 $args? ? ? ? ? ? ? ? ? ? ? ?與請求行的參數(shù)相等 $document_root? ? ?當前root命令指定的值 $uri? ? ? ? ? ? ? ? ? ? ? ? ? 當前request中的URI $document_uri? ? ? ? 同等$uri $host? ? ? ? ? ? ? ? ? ? ? ?與頭部"Host"行的值一致 $limit_rate? ? ? ? ? ? ? ?限制連接速率 $request_method? ? 同等于request的method GET或POST $remote_addr? ? ? ? ? 客戶端IP $remote_port? ? ? ? ? ?客戶端端口 $remote_user? ? ? ? ? ?用戶名? ngx_http_auth_basic_module認證 $request_filename? ? 當前請求的文件的路徑名,由root或alias與URI request組合而成 $request_uri? ? ? ? ? ? ? 參數(shù)完整的初始URI $query_string? ? ? ? ? ? 與$args一致 $server_name? ? ? ? ? ? 請求到達的服務器名 $server_port? ? ? ? ? ? ? ?請求到達的端口號 location ~ ^/best/ { rewirte ^/best/(.*)$ /test/$1 break; proxy_pass http://www.taob.com; }
location / { proxy_pass http://127.0.0.1:8080/; set $query $query_string; rewrite /dade /wordpress?$query?; } 可將http://www.tb.com/wp/?p=160的頁面重寫到www.tb.com/wordpress/?p=160 service { listen? ? ? ? ? ? ?80; server_name www.tb.cn? www.taob.com; if ($host != 'www.tb.cn') { rewirte ^/(.*)$ http://www.tb.cn/error.txt? bread; rewirte ^/(.*)$ http://www.tb.cn/$1?permanent; } }
nginx 編譯時注釋 auto/cc/gcc 的? CFLAGS="$CFLAGS -g" --with-cc-opt='-O3' --with-cpu-opt=CPU? [pentinm pentiumpro pentium3 pentium4 athlon opteron adm64 sparc32 sparc64 ppc64]? ? ?cat /proc/cpuinfo? |grep "model name"
TCMalloc 優(yōu)化Nginx性能? 1.安裝libunwind庫 2.安裝google-perftools 3.重新編譯nginx 添加參數(shù) --with-google_perftools_module 4.添加google-perftools線程目錄? 0777 權(quán)限 5.nginx主配置文件pid處寫入 google_perftools_profiles /tmp/tcmalloc; 6.重啟nginx 驗證
針對nginx的內(nèi)核優(yōu)化? ?/sbin/sysctl -p net.ipv4.tcp_max_tw_buckets = 6000? ? ? ? ? ? ? ?#timewait數(shù)量? 默認180000 net.ipv4.ip_local_port_range = 1024 65000? ? ?#允許系統(tǒng)打開的端口范圍 net.ipv4.tcp_tw_recycle = 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #啟用timewait快速回收 net.ipv4.tcp_tw_reuse = 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?#允許TIME-WAIT sockets net.ipv4.tcp_syncookies = 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ?#SYN等待隊列溢出時啟用cookies處理 net.core.somaxconn = 262144? ? ? ? ? ? ? ? ? ? ? ? ?#tcp并發(fā)連接 默認 128 net.core.netdev_max_backlog?= 262144? ? ? ? ? #網(wǎng)口數(shù)據(jù)包速率比內(nèi)核處理快時允許等到的隊列大小 net.ipv4.tcp_max_orphans = 262144? ? ? ? ? ? ? ? #設(shè)定最大套接字不被關(guān)聯(lián)到任何用戶文件句柄上 net.ipv4.tcp_max_syn_backlog?= 262144? ? ? ? ? #記錄尚未收到客戶端確認信息的連接請求最大值 net.ipv4.tcp_synack_retries = 1? ? ? ? ? ? ? ? ? ? ? ? ?#內(nèi)核放棄連接之前發(fā)送SYN+ACK包的數(shù)量 net.ipv4.tcp_syn_retres = 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?#內(nèi)核放棄建立連接前發(fā)送SYN包的數(shù)量 net.ipv4.tcp_fin_timeout = 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ?#保持FIN-WAIT-2狀態(tài)的時間 默認60 net.ipv4.tcp_keepalive_time = 30? ? ? ? ? ? ? ? ? ? ? #keepalive啟動時tcp發(fā)送的頻度 默認2


































總結(jié)

以上是生活随笔為你收集整理的高性能Linux架构实战 [高俊峰] 笔记摘要的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。