: Linux
##
一、系统参数调优
[xxxxx@localhost:/#]vi /etc/sysctl.d/99-sysctl.conf
##added by zhoutao on 2011/10/17
net.ipv4.tcp_max_syn_backlog = 10240
net.ipv4.tcp_max_tw_buckets = 400000
net.ipv4.tcp_max_orphans = 60000
net.ipv4.tcp_synack_retries = 3
net.ipv4.tcp_fin_timeout = 3
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.rmem_default = 1048576
net.core.wmem_default = 1048576
net.core.somaxconn = 16384
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.core.netdev_max_backlog = 3000
net.ipv4.tcp_congestion_control = cubic
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_tw_reuse = 1
net.ipv4.neigh.default.unres_qlen = 6
net.ipv4.neigh.default.proxy_qlen = 96
net.ipv4.ip_nonlocal_bind = 1
net.ipv4.tcp_keepalive_time = 60
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 10
fs.file-max = 360000
net.ipv4.conf.all.log_martians=1
net.nf_conntrack_max = 25000000
net.netfilter.nf_conntrack_max = 25000000
net.netfilter.nf_conntrack_tcp_timeout_established = 180
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 1
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120
有时候,真的不愿意用xmanager连服务器,再用GUI界面去创建、删除数据库,所以摸索了一下静默方式。以下内容是以oracle11gR2为参照版本的。
#
1、静默方式建库
oracle用户的主目录touch一个db_create.rsp文件,编辑该文件,内容如下:
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0.1.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "tasdb"
TEMPLATENAME = "General_Purpose.dbc"
CHARACTERSET = "ZHS16GBK"
oracle.install.db.InstallEdition = EE
SYSPASSWORD = oracle
SYSTEMPASSWORD = oracle
MEMORYPERCENTAGE = "15"
responsefile_version 响应文件版本,其实就是数据库版本
operation_type 静默操作类型
余下的内容请看稍后的响应文件例子。之后,执行这个命令开始建库:
dbca -silent -responseFile ./db_create.rsp
#
tomcat的运行模式
运行模式有三种:bio(默认),nio,apr。
bio
bio(blocking I/O),顾名思义,即阻塞式I/O操作,表示Tomcat使用的是传统的Java I/O操作(即java.io包及其子包)。Tomcat在默认情况下,就是以bio模式运行的。遗憾的是,就一般而言,bio模式是三种运行模式中性能最低的一种。我们可以通过Tomcat Manager来查看服务器的当前状态。
nio
Java SE 1.4及后续版本提供的一种新的I/O操作方式(即java.nio包及其子包)。Java nio是一个基于缓冲区、并能提供非阻塞I/O操作的Java API,因此nio也被看成是non-blocking I/O的缩写。它拥有比传统I/O操作(bio)更好的并发运行性能。
apr
Apache Portable Runtime/Apache可移植运行库,是Apache HTTP服务器的支持库。你可以简单地理解为,Tomcat将以JNI的形式调用Apache HTTP服务器的核心动态链接库来处理文件读取或网络传输操作,从而大大地提高Tomcat对静态文件的处理性能。 Tomcat apr也是在Tomcat上运行高并发应用的首选模式。
局方提供了一份安全扫描文件,提示两台服务器的openssh有漏洞,需要修补漏洞,鉴于此,更新系统的openssh到最新版本。
我们的服务器一般都是使用rhel 6.X x64的操作系统。
因为工作的原因,需要每日使用sftp获取远程主机上的文件,所以就在想能不能脚本化,这样就不用天天定时定点的在服务器前面守着了。
lftp是linux下面的一个ftp客户端工具,使用起来非常方便,它的参数如下:
[zhou@localhost ~]$ lftp -h
Usage: lftp [OPTS] <site>
`lftp' is the first command executed by lftp after rc files
-f <file> execute commands from the file and exit
-c <cmd> execute the commands and exit
--help print this help and exit
--version print lftp version and exit
Other options are the same as in `open' command
-e <cmd> execute the command just after selecting
-u <user>[,<pass>] use the user/password for authentication
-p <port> use the port for connection
<site> host name, URL or bookmark name
shadowsocks-libev是一款轻量级且功能丰富,面向嵌入式设备和低端VPS的SOCKS5代理软件。该软件以C语言开发,占用存储空间非常小,大概就几兆,能处理数千的连接。在运行时,占用内存约600K,CPU使用率不会超过5%。目前该开源软件由@madeya和@linusyang负责维护。
特色功能:
- 一次验证
- UDP中转
- 多用户
- 管理API
- ss-redir
- ss-tunel
- Fast Open