Paragraph pr27 = new Paragraph();
pr27.setIndentationLeft(20); //整段縮20
pr27.setLeading(11, 0); //行距縮小
pr27.setFirstLineIndent(-20.0f); //首行凸排
pr27.add(new Chunk( "一、聰明的你一定想到了,配合第一類第八課所教的項目符號/編號來用,是不是天作之合呢?", catFont));
Paragraph pr27 = new Paragraph();
pr27.setIndentationLeft(20); //整段縮20
pr27.setLeading(11, 0); //行距縮小
pr27.setFirstLineIndent(-20.0f); //首行凸排
pr27.add(new Chunk( "一、聰明的你一定想到了,配合第一類第八課所教的項目符號/編號來用,是不是天作之合呢?", catFont));
參考來源 https://www.linkedin.com/pulse/5-key-attributes-performance-tune-jdbc-connection-pool-malhotra/
https://commons.apache.org/proper/commons-dbcp/configuration.html
監控方法
https://wiki.apache.org/tomcat/FAQ/Monitoring
http://www.jcgonzalez.com/java-monitor-jdbc-connection-pool-servlet
你有connection leaks可以看這裡
Here is a quick guide to performance tune JDBC connection pool using 5 key attributes in Tomcat application server. Many java based applications where we observe database connection leaks can be tuned by applying these settings.
The 2 basic attributes listed below are used to define a minimum and maximum range of connections that can be allocated from JDBC connection pool to connect to a database server:
Connection最多maxActive 初始值initialSize
• initialSize: The initial number of connections that are created when the pool is started (Default value is 10)
• maxActive: The maximum number of active connections that can be allocated from this pool (Default value is 100)
Note: Sizing of these 2 attributes become increasingly important when the application server is running in a cluster mode (multiple instances) because every instance/node can make maxActive connections which could be a potential overhead at database end. The best way to judge optimal settings is to run the test at peak load and observe numActive attribute value of the connection pool.
5 Key Attributes to performance tune Tomcat JDBC Connection Pool:
These attributes enable pool sweeper ability of Tomcat server to evict/remove abandoned connections and move them back to JDBC connection pool for re-use thus avoiding max connection timeout issues.
1. maxWait: The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception. The exception would appear in application server logs which would look like "Timeout waiting for idle object" only after maxWait time has been reached. Default value is 30000 (30 seconds)
2. minEvictableIdleTimeMillis: The minimum amount of time an object may sit idle in the pool before it is eligible for eviction. This value needs to be determined basis on the type of application, like for an eCommerce or banking application the value would be different as compared to a reporting application. Default value is 60000 (60 seconds).
3. timeBetweenEvictionRunsMillis: The number of milliseconds to sleep between runs of the idle connection validation/cleaner thread. It dictates how often we check for idle, abandoned connections, and how often we validate idle connections. This value should not be set under 1 second as it could cause overhead on Tomcat server. Default value is 5000 (5 seconds).
4. removeAbandoned: This Flag is used to remove abandoned connections if they exceed removeAbandonedTimeout. If set to true a connection is considered abandoned and eligible for removal if it has been in use longer than the removeAbandonedTimeout. Setting this to true can recover database connections from applications that fail to close a connection. Default value is false.
5. removeAbandonedTimeout: Timeout in seconds before an abandoned (in use) connection can be removed. This value should be set to the longest running query your applications might have to avoid any unexpected customer experience. Default value is 60 (60 seconds).
Note: To enable pool sweeper ability "timeBetweenEvictionRunsMillis > 0" AND "removeAbandoned=true" AND "removeAbandonedTimeout > 0" condition should be met.
So, a typical setting in server.xml would look like:
initialSize="5" maxActive="200" maxWait="30000" minEvictableIdleTimeMillis="60000" timeBetweenEvictionRunsMillis="10000" removeAbandoned="true" removeAbandonedTimeout="180"
Oracle Client 的 ODBC連線設定Oracle的連線設定不對,常常會造成中文字碼讀出時變成亂碼的狀況,以下是Client的相關設定流程和步驟 :
(1)安裝Oracle Client
(2)檢查Oracle profile的連線時間設定(注意Time Out會影響連線穩定度)
(3)檢查Oracle帳號權限是否可讀取全部之Owner/Table,且有變更之權限
(4)設定Client端之ODBC連線
(5)檢查ODBC連線之編碼設定是否與Oracle編碼相同
Register 位置
/HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE/HOME0/NLS_LANG
Value = “TRADITIONAL CHINESE_TAIWAN.ZHT16DBT”
Value = “TRADITIONAL CHINESE_TAIWAN.UTF8”
Value = American.America.US7ASCII
(6)檢查Client端電腦之環境變數(非必要)
【開始】->【我的電腦】按右鍵->【內容】->【進階】->【環境變數】->【新增】
新增變數名稱 NLS_LANG,變數值設定如下:
Big5設定為 TRADITIONAL CHINESE_TAIWAN.ZHT16DBT
UTF8設定為 TRADITIONAL CHINESE_TAIWAN.UTF8
(7)設定Client端電腦之Oracle tnsnames.ora
開啟C:\Oracle\Ora81\network\ADMIN\tnsnames.ora
(8)以Oracle ODBC test測試Client端之ODBC連線是否正常
./runInstaller -ignoreSysPrereqs
--欄位長度不足
--CREATE SNAPSHOT
create snapshot RD_HUMAN_VACATION_LOG_SUM
REFRESH
START WITH TO_DATE('2009-05-27 09.09.36','yyyy-mm-dd hh24.mi.ss')
NEXT (sysdate+1)
AS SELECT a.* from HUMAN_VACATION_LOG_SUM a;
--手動更新SNAPSHOT
EXEC DBMS_SNAPSHOT.REFRESH('SNAPSHOT_NAME');
--更改snapshot的時間
alter snapshot W00_ACCT_EX_VIEW2
refresh
START WITH to_date(to_char(sysdate+1,'dd-mm-yyyy')|| ' 03:05:30','dd-mm-yyyy
hh24:mi:ss')
NEXT to_date(to_char(sysdate+1,'dd-mm-yyyy')|| ' 03:05:30','dd-mm-yyyy
hh24:mi:ss')
=REPT(0,8-LEN(A1))&A1
字串左邊補滿8個0
Windows 遠端桌面到CentOS
yum install gcc pam-devel openssl-devel
yum install autoconf automake libtool
yum install libX11-devel libXfixes-devel
yum install xrdp
wget http://sourceforge.net/projects/xrdp/files/xrdp/0.6.0/xrdp-v0.6.0.tar.gz/download
tar zxvf xrdp-v0.6.0.tar.gz
cd xrdp-v0.6.0
./bootstrap
./configure
make
make install
啟動 xrdp
/etc/xrdp/xrdp.sh start
關閉
/etc/xrdp/xrdp.sh stop
防火牆設定
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3389 -j ACCEPT
restart
/etc/init.d/iptables restart
5.改變預設的 Xwindows 和語系
在 /etc/xrdp/startwm.sh 裡可以更改遠端連線的預設語系和 Xwindow
這個我沒有去更改,詳情請參考我用來參考的網頁
出現:
connecting to 127.0.0.1 5910
error – problem connecting
要先安裝vnc-server
yum install vnc-server
vim /etc/sysconfig/vncservers
VNCSERVERS="2:root"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
設定密碼
vncpasswd
http://centoshelp.org/security/securing-sshd/
This howto outlines a few extra steps that can be taken to further secure a SSH server, chiefly from the constant onslaught of automated brute-force password attacks.
yum install openssh-server service sshd start
Most of the steps below involve editing the global SSH server configuration file located at /etc/ssh/sshd_config, and the access control tcpwrapper configuration files /etc/hosts.allow and /etc/hosts.deny. Use your favorite editor to modify these files as root.
Some or all of the following steps may be taken to secure your SSH server. The steps are sorted roughly in order of entirely sensible precaution to completely paranoid:
[root@nano ~]# ### top 5 most recently attacked accounts [root@nano ~]# lastb | awk '{print $1}' | sort | uniq -c | sort -rn | head -5 29 root 24 admin 16 sales 14 test 14 staff [root@nano ~]# ### top 5 most attacked accounts [root@nano ~]# awk 'gsub(".*sshd.*Failed password for (invalid user )?", "") {print $1}' /var/log/secure* | sort | uniq -c | sort -rn | head -5 723 root 66 admin 45 test 39 ftpuser 34 mysql [root@nano ~]# ### top 5 attacker IP addresses (obscured for privacy) [root@nano ~]# awk 'gsub(".*sshd.*Failed password for (invalid user )?", "") {print $3}' /var/log/secure* | sort | uniq -c | sort -rn | head -5 1042 193.251.XXX.XXX 556 85.21.XXX.XXX 373 218.189.XXX.XXX 284 121.156.XX.XXX 228 121.140.XX.XXX
You may want to use a utility called “john the ripper” to audit the strength of passwords on your system – if it cracks any too quickly, they’re too weak.
yum install denyhosts chkconfig denyhosts on service denyhosts start
#Port 22 Port 2222
#Protocol 2,1 Protocol 2
Note: This should be unnecessary as only Protocol 2 is enabled by default.
#PermitRootLogin yes PermitRootLogin no
PermitRootLogin without-password
PermitRootLogin forced-commands-only
#MaxStartups 10 MaxStartups 3:50:10>
#LoginGraceTime 2m LoginGraceTime 30
AllowUsers john mary joe*
AllowGroups sshusers
sshd: ALL
sshd: 192.168.1.0/255.255.255.0 sshd: 10.0.0.0/255.0.0.0 sshd: 24.42.69.101
You may also allow/deny connections via a firewall, but to maintain sanity it’s best to stick to one method or the other.
PasswordAuthentication no
ListenAddress 192.168.1.10
/etc/init.d/sshd restart