Come ,As you are ,As you were , As I want you to be
Sun ONE Directory Server Tuning
(作者置顶)
1 调整缓存大小。
2 优化索引。
250,000-1,000,000 个条目
硬盘添加至少 5 GB
内存添加至少 512 MB
* 几个概念:
nsslapd-cachememsize:
nsslapd-dbcachesize:
slapdBase = 75 MB +(nsslapd-threadnumber x 0.5 MB) +(nsslapd-maxconnections x 0.5 KB)
entryCacheSum = Sum 所有条目的缓存(nsslapd-cachememsize)
cacheSum = entryCacheSum + nsslapd-dbcachesize + nsslapd-import-cachesize
slapdSize = slapdBase + cacheSum
slapdGrowth = 20% x slapdSize作为初步估算,假定 20% 的开销用于处理客户机请求。实际百分比可根据特定部署的特性确定。在将 Directory Server 投入生产之前,请先凭经验验证此百分比。
slapdTotal = slapdSize + slapdGrowth
/proc/sys/fs/file-max
检查文件描述符限制.
Directory Server 在处理并发客户机连接时使用文件描述符。如果将系统中可用的或某个进程可用的文件描述符的最大数量设置为比较低的值,则可以限制并发连接的数量。
数据库缓存(nsslapd-dbcachesize)
确认 Directory Server 使用的内存没有超出可用物理内存的大小。超出可用物理内存造成系统重复地分页,导致性能严重降低。对于 32 位服务器,在实践中必须将数据库缓存大小限制为 2 GB 或更少。
条目缓存(nsslapd-cachememsize)
条目缓存存放最近访问的条目,并将其格式化以传递到客户机应用程序。指定后缀的条目缓存大小 (nsslapd-cachememsize) 和条目的最大数量 (nsslapd-cachesize)
总聚合缓存大小
除去用于文件系统缓存的内存,同时使用的所有缓存的总和必须小于可用物理内存的总大小。对于 32 位服务器,这意味着总的聚合缓存大小在实践中必须限制为 2 GB 或更少。
基本搜索处理 子树和一级搜索处理
nsslapd-dbcachesize = 1.2 x SUM所有 .db3 文件(文件大小)条目缓存槽数目和内存数量
nsslapd-cachesize = 4.5 x(LDIF 中的条目数)设想一个系统,其可用内存不足以同时将数据存放到条目和数据库缓存中,但仍允许系统在文件系统缓存中缓存数据。这种情况的关键在于最大限度的利用可用内存。 可以考虑设置尽可能低的条目和数据库缓存大小,为文件系统缓存留出尽可能多的内存。将内存保留给文件系统缓存至少可以阻止条目扩展到数据库,或条目的几率降低 3 到 4.5 倍,理论上限制了磁盘 I/O 活动。
nsslapd-cachememsize = 3.8 x(id2entry.db3 文件大小)
$ ldapsearch -D directoryManager -w password -b suffix objectclass=\* > /dev/null
$ searchrate -b suffix -f "(mail=%s)" -i mail.file -K -t 10可以使用 -K 和 -t 以节省时间。当使用 -K 选项时,searchrate 保持连接打开,仅绑定一次,不是为每个搜索绑定。-t 选项让您指定使用多少线程。 在填充了其他缓存后,可以填充可用的文件系统缓存。尽管无法保证文件系统缓存中的信息未被刷新,但填充文件系统缓存仍可提升发生剧烈变化的时间。
# for db in ServerRoot/slapd-serverID/db/*/*.db3
> do
> dd if='pwd'/$db of=/dev/null bs=512k
> done
0+1 records in
0+1 records out
Sun ONE Directory Server Tuning (last edited 2006-07-25 01:57:51 by zhouliqun)
Sun ONE Directory Server 5.2 Administration Guide
(作者置顶)
http://docs.sun.com/app/docs/doc/816-6698-10
INSTALLATION:
required:
libtermcap compat-db : libdb.so.3
ADIMINSTRATION 1.
ServerRoot : /var/Sun/mps/slapd-fangshan
start (from command line) : start-slapd
stop : stop-slapd
# ps -ef |grep ns-slapd
admin server daemon:
start :
/var/Sun/mps/start-admin
stop :
/var/Sun/mps/stop-admin
# ps -ef |grep admin-serv
Directory Server Console :
/var/Sun/mps/startconsole
DN: uid=admin, ou=Administrators, ou=TopologyManagement, o=NetscapeRoot DN: cn=Directory Manager
2. Creating Directory Entries
*Custom Editor
*Generic Editor
Managing Object Classes
Setting Referrals
how you can use referrals in your directory deployment, see the Sun ONE Directory Server Deployment Guide.
Setting the Default Referrals
Creating Smart Referrals
3. Creating Your Directory Tree
Root Suffix
sub-suffixes
Chained suffix :refer to Chapter 5, "Designing the Directory Topology,"
Creating a New Root Suffix :
By convention, root suffixes use domain-component (dc) naming attributes
(1)data ->new suffix (2)new root object
Creating a New Subsuffix
(1) data-> new subsuffix (2) new -> ou
Managing Suffixes
Disabling or Enabling a Suffix
Setting Access Permissions and Referrals
Deleting a Suffix
Creating Chained Suffixes
However, before you create any chained suffixes, you should create a proxy identity on the remote server.
(1)Creating a Proxy Identity on cn=config ,uid=proxy_host
(2)data-> new Chianed Suffix
(3)enter the bindDN and pasword uid=proxy_host,cn=config
(4)add the ACI to the entry with the suffixDN on the remote server
Restoring the dse.ldif Configuration File
The directory creates two backup copies of the dse.ldif file in the following directory:
ServerRoot/slapd-serverID/config
The dse.ldif.startOK file records a copy of the dse.ldif file at server start up. The dse.ldif.bak file contains a backup of the most recent changes to the dse.ldif file. Copy the file with the most recent changes to your directory.
Adding a New Static Group
cn (common name)
Managing Access Control
Default ACIs
All users have anonymous access to the directory for search, compare, and read operations.
Bound users can modify their own entry in the directory, but not delete it.
admin has all rights except proxy rights.
ACI Syntax
aci: (target)(version 3.0;acl "name";permission bindRules;)
For example:
(targetattr=*)(target = "ldap:///ou=haidian, dc=health,dc=com")(version 3.0;acl "Allows use of proxys1 for chaining";
allow (proxy) (userdn="ldap:///uid=proxys1,cn=config");)
Setting Individual Resource Limits
Sun ONE Directory Server 5.2 Administration Guide (last edited 2006-07-21 00:38:39 by zhouliqun)
IPTABLES & L7FILTER
(作者置顶)
1.kernel patch & iptables patch
2.compile iptables
3.load modules
ipt_TOS
ipt_state
ipt_LOG
iptable_nat
ip_conntrack
iptable_mangle
iptable_filter
ip_tables
ipt_layer7
4.config gShield
5 config blacklist
6 add ipp2p rule
iptables -t mangle -I POSTROUTING -m layer7 --l7proto pat_name -j DROP
IPTABLES & L7FILTER (last edited 2006-07-13 07:31:00 by zhouliqun)
http://iptables-tutorial.frozentux.net/cn/iptables-tutorial-cn-1.1.19.html
LIFERAY INSTALLATION GUIDE
(作者置顶)
Liferay 系统配置文档
官方网站地址:www.liferay.com
环境: Linux JDK1.5 Mysql5.5 Tomcat5.5.16
安装:
1.下载安装JDK1.5,配置JAVA_HOME环境变量。
2.下载安装Tomcat5.5.16
3.下载解压liferay-portal-sql-Version.zip
4.创建数据库
5.下载liferay-portal-pro-Version.war
3.编辑$CATALINA_HOME/conf/Catlina/localhost/ROOT.xml
<Context path="" docBase="../liferay" debug="0" reloadable="true" crossContext="true">
<Resource
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://DB_HOST/lp?useUnicode=true&characterEncoding=UTF-8"
username="DB_USER"
password="DB_PASSWD"
maxActive="20"
/>
<Resource
name="mail/MailSession"
auth="Container"
type="javax.mail.Session"
mail.transport.protocol="smtp"
mail.smtp.host="SMTP_SERVER_ADDRESS"
mail.smtp.username="USER_NAME"
mail.smtp.password="USER_PASSWD"
/>
<Realm
className="org.apache.catalina.realm.JAASRealm"
appName="PortalRealm"
userClassNames="com.liferay.portal.security.jaas.PortalPrincipal"
roleClassNames="com.liferay.portal.security.jaas.PortalRole"
debug="99"
useContextClassLoader="false"
/>
</Context>
4.编辑$CATALINA_HOME/conf/jaas.config
PortalRealm {
com.liferay.portal.security.jaas.PortalLoginModule required;
};
5.启动tomcat
$CATALINA_HOME/bin/startup.sh
6.配置完成
说明:
公司内部liferay安装在192.168.0.12上,安装目录/opt/liferay/new3 数据库lp@192.168.0.12,用户名lp,密码lp 访问地址http://liferay.hitb.com.cn
公司外部liferay安装在192.168.0.12上,安装目录/usr/hitb/liferay 数据库liferay@192.168.0.12,用户名liferay,密码liferay 访问地址http://www.hitb.com.cn:8082
备份:192.168.0.12和192.168.0.6上的mysql数据库实时同步.
LIFERAY INSTALLATION GUIDE (last edited 2006-07-11 08:02:38 by zhouliqun)
JIRA INSTALLATION GUIDE
(作者置顶)
JIRA 系统配置
官方网站地址: www.atlassian.com
环境: Linux JDK1.5 Mysql5.5 Tomcat5.5.12
安装: 1.下载安装JDK1。5,配置JAVA_HOME环境变量。
2.下载安装Tomcat5.5.12
3.下载解压atlassian-jira-enterprise-VERSION.tar.gz
4.登录到mysql
mysql> create database jiradb;
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on
jiradb.* TO 'jirauser'@'localhost' IDENTIFIED BY 'mypassword';
mysql> update user set host='localhost.localdomain' where user='jirauser';
mysql> flush privileges;
5.编辑$JIRA_HOME/edit-webapp/WEB-INF/classes/entityengine.xml
helper-class="org.ofbiz.core.entity.GenericHelperDAO"
field-type-name="mysql"
check-on-start="true"
use-foreign-keys="false"
use-foreign-key-indices="false"
check-fks-on-start="false"
check-fk-indices-on-start="false"
add-missing-on-start="true">
jndi-name="java:comp/env/jdbc/JiraDS" />
6.执行build.sh,生成一个war文件在dist-tomcat目录
7.下载jira-jars-tomcat5.zip,复制这些jar到Tomcat的common/lib/目录
8.复制dist-tomcat/tomcat-5.5/jira.xml到conf/Catalina/localhost目录
9.编辑jira.xml
username="sa"
password=""
driverClassName="org.hsqldb.jdbcDriver"
url="jdbc:mysql://localhost:3306/jrdb?autoReconnect=true&useUnicode=true&characterEncoding=utf-8"
minEvictableIdleTimeMillis="4000"
timeBetweenEvictionRunsMillis="5000"/>
factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
10.启动浏览器访问:http://serverhost:8080/jira,出现配置安装界面。
11.输入License Key,输入管理员帐号密码,设置完成.
Install Oracle 10g Express Edition on Gentoo Linux
(作者置顶)
Visual SourceSafe 教程
(作者置顶)
ORACLE FOR SUN SOLARIS 维护手册
(作者置顶)
VSS使用手册
(作者置顶)
Toad 使用快速入门
(作者置顶)
Shell tips
(作者置顶)
Using session persistence manager
(作者置顶)
To enable session replication in Tomcat, three different paths can be followed to achieve the exact same thing:
1.Using session persistence, and saving the session to a shared file system (PersistenceManager)
2.Using session persistence, and saving the session to a shared database (JDBCManager)
3.Using in-memory-replication, using the SimpleTcpCluster that ships with Tomcat 5
Tomcat has its own default session storage mechanism (temporary files). To override the default and save sessions in MySQL via JDBC instead, use the following procedure:1. Create the Tomcat session table
(
id VARCHAR(32) NOT NULL,
app VARCHAR(255),
data MEDIUMBLOB,
valid_session CHAR(1) NOT NULL,
max_inactive INT NOT NULL,
last_access BIGINT NOT NULL,
PRIMARY KEY (id),
INDEX (app)
);
mysql-connector-java-3.0.15-ga-bin.jar,Generally, that means you must place the JAR
file containing this driver into the $CATALINA_HOME/server/lib
directory (if your applications do not also need it) or into the
$CATALINA_HOME/common/lib directory (if you wish to share
this driver with your web applications.
3. Modify the Tomcat Configuration File
modify the META-INF/context.xml:
debug="99"
saveOnRestart="true"
minIdleSwap="0"
maxIdleSwap="0"
maxIdleBackup="0">
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://sun.tianji.com:3306/tomcat?user=jira&password=jira"
sessionTable="tomcat_sessions"
sessionAppCol="app_name"
sessionIdCol="session_id"
sessionDataCol="session_data"
sessionValidCol="valid_session"
sessionMaxInactiveCol="max_inactive"
sessionLastAccessedCol="last_access"
checkInterval="1" />checkInterval:检查session是否过期的时间间隔,以秒为单位,缺省值为60秒。maxIdleBackup:自上次访问某个session到这个session可以被保存到存储介质上的时间间隔。以秒为单位,如果为-1,则disable这个特征。缺省情况下,这个特征是disable的。maxIdleSwap:自上次访问某个session到session应该被保存到存储介质上,并从服务器的内存中交换出来之间的时间间隔。如果为-1,则disable这个特征。如果使能了这个特征,指定值应该大于或者等于maxIdleBackup。缺省情况下这个特征是disable的。minIdleSwap: 自上次访问某个session到session可以被保存到存储介质上,并从服务器的内存中交换出来之间的时间间隔。如果为-1,说明可以在任何时间交换出来。指定值应该小于maxIdleSwap。缺省情况下这个特征是disable的。
4.conf/server.xml :
comment the cluster entry.
Windows Tips
MoinMoin INSTALLATION GUIDE
环境: Linux ,Python2.4.x ,Apache2.x
安装:
1.测试Python
python -V
2.下载解压moin-1.5.0.tar.gz
3.安装MoinMoin
cd moin-1.5.0
python -v setup.py --quiet install --record=install.log
python
>>> import MoinMoin
>>>
4.创建实例
cd /opt
mkdir hitbwiki
cp -R /usr/share/moin/data /opt/hitbwiki
cp -R /usr/share/moin/underlay /opt/hitbwiki
cp /usr/share/moin/config/wikiconfig.py /opt/hitbwiki
chown -R apache:apache /opt/hitbwiki
chmod -R ug+rwx /opt/hitbwiki
chmod -R o-rwx /opt/hitbwkik
5.安装moin.cgi
cd /opt/hitbwkik
mkdir cgi-bin
cp /usr/share/moin/server/moin.cgi cgi-bin
chown -R apache:apache cgi-bin
chmod -R ug+rx cgi-bin
chmod -R o-rwx cgi-bin
6.配置moin.cgi
import sys
sys.path.insert(0,'..')
7 安装apache Mod_python
./configure --with-apxs=$APACHE_PATH/bin/apxs
make
make install
8.配置apache
LoadModule python_module modules/mod_python.so
... ...
PythonHandler MoinMoin.request::RequestModPy.run
DocumentRoot /opt/hitbwiki
ServerName wiki.hitb.com.cn
ErrorLog logs/wiki.hitb.com.cn-error_log
CustomLog logs/wiki.hitb.com.cn-access_log common
Alias /wiki/ "/usr/share/moin/htdocs/"
RewriteEngine On
RewriteLogLevel 0
RewriteRule ^/wiki/(.*)$ /usr/share/moin/htdocs/$1 [last]
RewriteRule ^/robots.txt$ /usr/share/moin/htdocs/robots.txt [last]
RewriteRule ^/favicon.ico$ /usr/share/moin/htdocs/favicon.ico [last]
RewriteRule ^(.*)$ /opt/hitbwiki/moinmodpy.py$1
AddHandler Python-program .py
PythonPath "[ '/opt/hitbwiki' ] + sys.path "
#PythonHandler moinmodpy
9.配置moinmoin
data_dir = '/opt/hitbwiki/data/'
data_underlay_dir = '/opt/hitbwiki/underlay/'
[Make sure you use only absolute paths - relative paths will not work!]
url_prefix = '/wiki'
10 完成
重启apache ,访问 http://127.0.0.1/mywiki/
Tomcat 的数据库连接池设置与应用
Mysql tips
1.
myisamchk tablename.MYI
进行检测,如果需要修复的话,可以使用:
myisamchk -of tablename.MYI
关于myisamchk的详细参数说明,可以参见它的使用帮助。需要注意的时在进行修改时必须确保MySQL服务器没有访问这个数据表,保险的情况下是最好在进行检测时把MySQL服务器Shutdown掉。
另外可以把下面的命令放在你的rc.local里面启动MySQL服务器前:
[ -x /tmp/mysql.sock ] && /pathtochk/myisamchk -of /DATA_DIR/*/*.MYI
其中的/tmp/mysql.sock是MySQL监听的Sock文件位置,对于使用RPM安装的用户应该是/var/lib/mysql/mysql.sock,对于使用源码安装则是/tmp/mysql.sock可以根据自己的实际情况进行变更,而pathtochk则是myisamchk所在的位置,DATA_DIR是你的MySQL数据库存放的位置。
需要注意的时,如果你打算把这条命令放在你的rc.local里面,必须确认在执行这条指令时MySQL服务器必须没有启动!
2.忘了root密码
先停掉mysql,以--skip-grant-table 启动
#mysqld_safe --skip-grant-table &
mysql>
use mysql;
update user set password=password('newpassword') where user='root';
mysql> exit
重启
3.允许远程连接
grant all on *.* to root@"%" identified by 'password' whit grant option;
Install Jboss JBPM
Install Subversion and LDAP