2009年7月30日星期四

怎么查安装CRS时设置的cluster name呢?

我的測試環境:

[oracle@croracle01 ~]$ cemutlo
Usage: /u01/app/crs/bin/cemutlo.bin [-n] [-w]
where:
-n prints the cluster name
-w prints the clusterware version in the following format:
::
[oracle@croracle01 ~]$ cemutlo -n
croracl_cluster
[oracle@croracle01 ~]$

emca -repos recreate 實驗

[oracle@croracle01 ~]$ emca -repos recreate

STARTED EMCA at Jul 31, 2009 8:14:43 PM
EM Configuration Assistant, Version 11.1.0.5.0 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.

Enter the following information:
Jul 31, 2009 8:14:43 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngine
SEVERE: No SID specified
Database SID: crprod1
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:

Do you wish to continue? [yes(Y)/no(N)]: y
Jul 31, 2009 8:15:02 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/crprod/emca_2009_07_31_20_14_43.log.
Jul 31, 2009 8:15:06 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...

Jul 31, 2009 8:27:37 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Jul 31, 2009 8:27:37 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...

Jul 31, 2009 8:48:32 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Enterprise Manager configuration completed successfully
FINISHED EMCA at Jul 31, 2009 8:48:32 PM
[oracle@croracle01 ~]$

mysql replication 實驗

master croracle03 ip 172.16.1.168
slave croracle01 ip 172.16.1.165

1 Master Mysql server install
[root@croracle03 ~]# rpm -ivh MySQL-server-community-5.1.36-0.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server-community ########################################### [100%]

090801 9:28:31 [Warning] Forcing shutdown of 2 plugins
090801 9:28:31 [Warning] Forcing shutdown of 2 plugins

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h croracle03.localdomain password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/

Starting MySQL....[ OK ]
Giving mysqld 2 seconds to start
[root@croracle03 ~]#
[root@croracle03 ~]#

2 Master Mysql client install
[root@croracle03 ~]# rpm -ivh MySQL-client-community-5.1.36-0.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client-community ########################################### [100%]
[root@croracle03 ~]#


3 standby mysql server install

[root@croracle01 ~]# rpm -ivh MySQL-server-community-5.1.36-0.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server-community ########################################### [100%]
090729 22:49:20 [Warning] Forcing shutdown of 2 plugins
090729 22:49:20 [Warning] Forcing shutdown of 2 plugins

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h croracle01.localdomain password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/

Starting MySQL...........[ OK ]
Giving mysqld 2 seconds to start
[root@croracle01 ~]#

4 standby mysql client install


[root@croracle01 ~]# rpm -ivh MySQL-client-community-5.1.36-0.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client-community ########################################### [100%]
[root@croracle01 ~]#



5 主服務器設置replication用戶帳號
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.36-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> grant replication slave on *.* to 'repl'@'172.16.1.165' identified by 'password';
Query OK, 0 rows affected (0.00 sec)

mysql>


6 配置 my.cnf文檔
[root@croracle03 mysql]# cd /usr/share/mysql/
[root@croracle03 mysql]#

[root@croracle03 mysql]# cp my-large.cnf /etc/my.cnf

[root@croracle03 init.d]# ./mysql restart
Shutting down MySQL.. [ OK ]
Starting MySQL... [ OK ]
[root@croracle03 init.d]#



[root@croracle01 init.d]# ./mysql restart
Shutting down MySQL.. [ OK ]
Starting MySQL... [ OK ]
[root@croracle01 init.d]#


7 修改master my.conf文件
修改:
log-bin=/var/lib/mysql/mysql-bin
server-id = 1



data目錄的位置:

[root@croracle03 mysql]# pwd
/var/lib/mysql

[root@croracle03 mysql]# ls
croracle03.localdomain.err ib_logfile0 mysql-bin.000001 test
croracle03.localdomain.pid ib_logfile1 mysql-bin.index
ibdata1 mysql mysql.sock

reboot mysql
[root@croracle03 init.d]# ./mysql restart
Shutting down MySQL. [ OK ]
Starting MySQL. [ OK ]


8 master中設置讀鎖定.

mysql> flush tables with read locks;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'locks' at line 1 <--有可能會報著個錯 mysql>

--建立一個database
mysql> create database replDB
-> ;
Query OK, 1 row affected (0.00 sec)

mysql> use replDB
Database changed
mysql>
mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)

mysql>


mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000005 | 193 | | |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

mysql>

9 tar 和cp
[root@croracle03 mysql]# pwd
/var/lib/mysql
[root@croracle03 mysql]# ll
total 20568
-rw-rw---- 1 mysql root 6774 Aug 1 10:01 croracle03.localdomain.err
-rw-rw---- 1 mysql mysql 5 Aug 1 10:01 croracle03.localdomain.pid
-rw-rw---- 1 mysql mysql 10485760 Aug 1 10:01 ibdata1
-rw-rw---- 1 mysql mysql 5242880 Aug 1 10:01 ib_logfile0
-rw-rw---- 1 mysql mysql 5242880 Aug 1 09:28 ib_logfile1
drwx--x--x 2 mysql mysql 4096 Aug 1 09:28 mysql
-rw-rw---- 1 mysql mysql 125 Aug 1 09:55 mysql-bin.000001
-rw-rw---- 1 mysql mysql 125 Aug 1 09:57 mysql-bin.000002
-rw-rw---- 1 mysql mysql 125 Aug 1 10:01 mysql-bin.000003
-rw-rw---- 1 mysql mysql 125 Aug 1 10:01 mysql-bin.000004
-rw-rw---- 1 mysql mysql 193 Aug 1 10:06 mysql-bin.000005
-rw-rw---- 1 mysql mysql 121 Aug 1 10:01 mysql-bin.index
srwxrwxrwx 1 mysql mysql 0 Aug 1 10:01 mysql.sock
drwx------ 2 mysql mysql 4096 Aug 1 10:06 replDB
drwxr-xr-x 2 mysql mysql 4096 Aug 1 09:28 test
[root@croracle03 mysql]#



[root@croracle03 mysql]# tar cvfz replDB-master.tar.gz replDB/
replDB/
replDB/db.opt
[root@croracle03 mysql]# sftp croracle01
Connecting to croracle01...
root@croracle01's password:
sftp> cd /var/lib/mysql
sftp> put *.tar.gz
Uploading replDB-master.tar.gz to /var/lib/mysql/replDB-master.tar.gz
replDB-master.tar.gz 100% 206 0.2KB/s 00:00
sftp> quit



[root@croracle03 mysql]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.36-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use replDB
Database changed
mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)

mysql>


--在slave上面展包
[root@croracle01 mysql]# tar xvfz replDB-master.tar.gz
replDB/
replDB/db.opt
tar: replDB/db.opt: time stamp 2009-08-01 10:06:16 is 211598 s in the future
tar: replDB: time stamp 2009-08-01 10:06:16 is 211598 s in the future
--因為兩個vmware的實例的時間不一致,不過沒有關係

在slave服務器中

/etc/my.cnf
# but will not function as a master if omitted
server-id = 2

改變啟動方式:
[root@croracle01 init.d]# ./mysql stop
Shutting down MySQL. [ OK ]
[root@croracle01 init.d]#

[root@croracle01 init.d]# which mysqld_safe
/usr/bin/mysqld_safe

[root@croracle01 bin]# chmod +x mysql_slave.sh
--自己寫了一個簡單的腳本
[root@croracle01 bin]# cat mysql_slave.sh
#!/bin/sh
/usr/bin/mysqld_safe --skip-slave-start &
[root@croracle01 bin]#


[root@croracle01 bin]# mysql_slave.sh
[root@croracle01 bin]# 090729 23:24:59 mysqld_safe Logging to '/var/lib/mysql/croracle01.localdomain.err'.
090729 23:25:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

[root@croracle01 bin]#
--啟動
[root@croracle01 bin]# netstat -tln |grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN


slave的mysql配置




[root@croracle01 init.d]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.36-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)



mysql> change master to
-> master_host='172.16.1.168',
-> master_port=3306,
-> master_user='repl',
-> master_password='password',
-> master_log_file='mysql-bin.000005',
-> master_log_pos=193;
Query OK, 0 rows affected (0.07 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)



mysql> show processlist \G
*************************** 1. row ***************************
Id: 1
User: root
Host: localhost
db: NULL
Command: Query
Time: 0
State: NULL
Info: show processlist
*************************** 2. row ***************************
Id: 2
User: system user
Host:
db: NULL
Command: Connect
Time: 23
State: Waiting for master to send event
Info: NULL
*************************** 3. row ***************************
Id: 3
User: system user
Host:
db: NULL
Command: Connect
Time: -211864
State: Has read all relay log; waiting for the slave I/O thread to update it
Info: NULL
3 rows in set (0.00 sec)

mysql>




開始測試:

開始測試:

Master DB

mysql> use replDB;
Database changed
mysql> create table repl_test (id int);
Query OK, 0 rows affected (0.02 sec)

mysql> insert into repl_test values(1),(2),(3),(4),(5);
Query OK, 5 rows affected (0.01 sec)
Records: 5 Duplicates: 0 Warnings: 0

mysql>

mysql> select * from repl_test;
+------+
| id |
+------+
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
+------+
5 rows in set (0.00 sec)

mysql>


slave DB



[root@croracle01 init.d]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.36-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

mysql> use replDB;
Database changed
mysql> show tables;
+------------------+
| Tables_in_replDB |
+------------------+
| repl_test |
+------------------+
1 row in set (0.00 sec)

mysql> select * from repl_test;
+------+
| id |
+------+
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
+------+
5 rows in set (0.00 sec)

mysql>

2009年7月28日星期二

linux bonding的用法

在配置Oracle RAC 中用到了linux bonding的東西,簡單記錄一下:
linux版本是RedHat 5.2企業版
/etc/modprobe.conf

##for RAC
alias bond0 bonding
options bonding miimon=100 mode=1
alias bond1 bonding
options bonding miimon=100 mode=1


[oracle@oracle03 network-scripts]$ pwd
/etc/sysconfig/network-scripts


[oracle@oracle03 network-scripts]$ cat ifcfg-bond0
DEVICE=bond0
USERCTL=no
ONBOOT=yes
IPADDR=172.16.12.24 <--這裡不是oracle的那個vip,是真實的ip
NETMASK=255.255.255.0



[oracle@oracle03 network-scripts]$ cat ifcfg-bond1
DEVICE=bond1
USERCTL=no
ONBOOT=yes
IPADDR=192.168.0.3
NETMASK=255.255.255.0


[oracle@oracle03 network-scripts]$ cat ifcfg-eth0
# Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:1E:C9:AB:FF:3B
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes


[oracle@oracle03 network-scripts]$ cat ifcfg-eth1
# Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet
DEVICE=eth1
BOOTPROTO=none
HWADDR=00:1E:C9:AB:FF:3D
ONBOOT=yes
MASTER=bond1
SLAVE=yes
USERCTL=no

當然,bonding一般用於多個NIC綁定在一起(比如,eth0,eth1-->bond0;eth2,eth3-->bond1),1增加網路傳輸的穩定性2擴展帶寬,因為這裡是實驗環境,做了一個測試使用,不過原理類似.

2009年7月22日星期三

windows環境下查看端口佔用情況的netstat命令

C:\Documents and Settings\test>netstat -aon |findstr 80
TCP 0.0.0.0:8009 0.0.0.0:0 LISTENING 572
TCP 127.0.0.1:3615 127.0.0.1:912 ESTABLISHED 2180
TCP 127.0.0.1:8005 0.0.0.0:0 LISTENING 572
TCP 127.0.0.1:8307 127.0.0.1:1680 CLOSE_WAIT 2072
TCP 127.0.0.1:8307 127.0.0.1:3280 CLOSE_WAIT 2072
TCP 172.16.1.240:1145 60.28.216.15:80 CLOSE_WAIT 3984
TCP 172.16.1.240:1228 63.150.131.166:80 ESTABLISHED 1480
TCP 172.16.1.240:1229 72.5.124.92:80 CLOSE_WAIT 1480
TCP 172.16.1.240:1625 72.14.203.102:80 CLOSE_WAIT 2476
TCP 172.16.1.240:2296 172.16.1.162:22 ESTABLISHED 2780
TCP 172.16.1.240:2595 63.150.131.166:80 ESTABLISHED 2888
TCP 172.16.1.240:2857 72.14.203.103:80 ESTABLISHED 2476
TCP 172.16.1.240:2866 207.171.185.197:80 ESTABLISHED 2476
TCP 172.16.1.240:2904 64.233.189.147:80 ESTABLISHED 2476
TCP 172.16.1.240:2905 64.233.189.147:80 ESTABLISHED 2476
TCP 172.16.1.240:2906 64.233.189.99:80 ESTABLISHED 2476
TCP 172.16.1.240:3598 172.16.1.240:8333 ESTABLISHED 2180
TCP 172.16.1.240:3600 172.16.1.240:8333 ESTABLISHED 2180
TCP 172.16.1.240:3601 172.16.1.240:8333 ESTABLISHED 2180

C:\Documents and Settings\test>netstat -aon |findstr :80
TCP 0.0.0.0:8009 0.0.0.0:0 LISTENING 572
TCP 127.0.0.1:8005 0.0.0.0:0 LISTENING 572
TCP 172.16.1.240:1145 60.28.216.15:80 CLOSE_WAIT 3984
TCP 172.16.1.240:1228 63.150.131.166:80 ESTABLISHED 1480
TCP 172.16.1.240:1229 72.5.124.92:80 CLOSE_WAIT 1480
TCP 172.16.1.240:1625 72.14.203.102:80 CLOSE_WAIT 2476
TCP 172.16.1.240:2595 63.150.131.166:80 ESTABLISHED 2888
TCP 172.16.1.240:2857 72.14.203.103:80 ESTABLISHED 2476
TCP 172.16.1.240:2866 207.171.185.197:80 ESTABLISHED 2476
TCP 172.16.1.240:2904 64.233.189.147:80 ESTABLISHED 2476
TCP 172.16.1.240:2905 64.233.189.147:80 ESTABLISHED 2476
TCP 172.16.1.240:2906 64.233.189.99:80 ESTABLISHED 2476

C:\Documents and Settings\test>netstat -aon |findstr 0.0:80
TCP 0.0.0.0:8009 0.0.0.0:0 LISTENING 572

2009年7月15日星期三

怠为万恶之源

任继愈先生说:“怠为万恶之源。” 季羡林先生说:“不完满才是人生。”

人类从东非草原直立行走,在黑暗中侥幸走了三百万年;一万年前人类依然还在野蛮中挣扎,少有文明;两千多年前,孔夫子点燃了一盏灯,告别了万古长如夜;人类有目标的历史并不算长,区区几千年而已。--馬未都馬爺 如是說

sendmail 實驗

1. 設定sendmail 可以接收外部連線

修改 sendmail.mc

DAEMO_OPTIONS( `Port=smtp,Addr=0.0.0.0, Name=MTA')dnl

建立新的 sendmail.cf 設定檔

m4 sendmail.mc > sendmail.cf

測式:
[root@crim mail]# netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:642 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 172.16.1.176:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN <--這裡有問題, tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN tcp 0 0 :::22 :::* LISTEN tcp 0 0 ::1:953 :::* LISTEN [root@crim mail]# telnet localhost 25 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. 220 crim.localdomain ESMTP Sendmail 8.13.8/8.13.8; Tue, 14 Jul 2009 22:25:24 +0800 ^^^] telnet> exit
?Invalid command
telnet>
[root@crim init.d]# ./sendmail stop
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
[root@crim init.d]# ./sendmail start
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
[root@crim init.d]# netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:642 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 172.16.1.176:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:953 :::* LISTEN


[root@crim init.d]# telnet 172.16.1.176 25
Trying 172.16.1.176...
Connected to 172.16.1.176 (172.16.1.176).
Escape character is '^]'.
220 crim.localdomain ESMTP Sendmail 8.13.8/8.13.8; Tue, 14 Jul 2009 22:33:54 +0800

QUIT
Connection closed by foreign host.





[root@crim init.d]# cat /etc/mail/local-host-names
# local-host-names - include all aliases for your machine here.
openemm.testDomain.com


設定smtp認證

安裝 cyrus-sasl-md5 cyrus-sasl-plain cyrus-sasl 套件
[root@crim init.d]# yum install cyrus-sasl-md5 cyrus-sasl-plain cyrus-sasl
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.cs.pu.edu.tw
* updates: ftp.cs.pu.edu.tw
* addons: ftp.cs.pu.edu.tw
* extras: ftp.cs.pu.edu.tw
Setting up Install Process
Parsing package install arguments
Package cyrus-sasl-plain-2.1.22-4.i386 already installed and latest version
Package cyrus-sasl-2.1.22-4.i386 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package cyrus-sasl-md5.i386 0:2.1.22-4 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
cyrus-sasl-md5 i386 2.1.22-4 base 45 k

Transaction Summary
================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 45 k
Is this ok [y/N]: y
Downloading Packages:
cyrus-sasl-md5-2.1.22-4.i386.rpm | 45 kB 00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : cyrus-sasl-md5 [1/1]

Installed: cyrus-sasl-md5.i386 0:2.1.22-4
Complete!
[root@crim init.d]# rpm -qa |grep cyrus
cyrus-sasl-plain-2.1.22-4
cyrus-sasl-lib-2.1.22-4
cyrus-sasl-2.1.22-4
cyrus-sasl-devel-2.1.22-4
cyrus-sasl-md5-2.1.22-4


修改之前的 /etc/mail/sendmail.mc

將下面兩行最前面的 dnl 拿掉
52 TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
53 define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

重新產生sendmail.cf檔 : m4 sendmail.mc > sendmail.cf

重新啟動 sendmail 服務: service sendmail restart
[root@crim mail]# m4 sendmail.mc >sendmail.cf
[root@crim mail]# diff sendmail.cf sendmail.cf.change1
19c19
< ##### built by root@crim.localdomain on Tue Jul 14 22:46:16 HKT 2009 --- > ##### built by root@crim.localdomain on Tue Jul 14 22:23:52 HKT 2009
142d141
< authmechanisms="EXTERNAL"> #O AuthMechanisms=EXTERNAL GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5
1238c1237
<> R$* $#error $@ 5.7.1 $: "550 Relaying denied"
[root@crim mail]#



[root@crim mail]# /etc/init.d/sendmail restart
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
[root@crim mail]#


利用telnet 測式smtp認證功能是否生效(要有出現 LOGIN PLAIN才算)


[root@crim mail]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 crim.localdomain ESMTP Sendmail 8.13.8/8.13.8; Tue, 14 Jul 2009 22:48:00 +0800
ehlo localhost
250-crim.localdomain Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
250-DELIVERBY
250 HELP

------------------------------------

[root@crim mail]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 crim.localdomain ESMTP Sendmail 8.13.8/8.13.8; Tue, 14 Jul 2009 22:51:19 +0800
HELO cri.com.hk
250 crim.localdomain Hello localhost.localdomain [127.0.0.1], pleased to meet you
MAIL FROM:ivantest@openemm.testDomain.com
250 2.1.0 ivantest@openemm.testDomain.com... Sender ok
RCPT TO:ivanyao@xxx.com
250 2.1.5 ivanyao@xxx.com... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
From : ivantest@openemm.testDeomain.com
to : testOpenemmSendmail
Subject: testSendmail
This is a test mail
.
250 2.0.0 n6EEpJ0l006399 Message accepted for delivery
QUIT
221 2.0.0 crim.localdomain closing connection
Connection closed by foreign host.
[root@crim mail]#


用windows Live Mail可以收到了

ivantest@openemm.testDomain.com;
收件人:testOpenemmSendmail@crim.localdomain;
testSendmail <--這個是標題 This is a test mail <--內容

openEMM上手記

領導希望研究一個opensource 的電子郵件營銷系統 openemm http://www.openemm.org/
上面介紹如下:

OpenEMM is a feature-rich enterprise software for professional e-mail newsletters and e-mail marketing. It offers sophisticated bounce management, link tracking, lots of statistics and a script feature to set up transaction mails (data, event and time triggered).

還沒有玩過這個東東,download下來,準備搭建一個實驗環境跑跑,有一個直觀的感覺:

1, 在虛擬機vmware2.x + centos5.2 上

2,根據系統要求,bind, sendmail(當然其他的也可以,不過這種老牌子的MTA還沒有玩過)順便一起學習了,這裡爲了快用yum方式下載的

3,基本上跟著他們的安裝文檔走,記錄一下我認為重要的:

dns配置:


[root@crim etc]# rpm -qa |grep bind
bind-chroot-9.3.4-10.P1.el5_3.1
bind-utils-9.3.4-10.P1.el5_3.1
bind-9.3.4-10.P1.el5_3.1
bind-libs-9.3.4-10.P1.el5_3.1
ypbind-1.19-11.el5
[root@crim etc]#

增加該包以後,基本上所有的配置都要在/var/named/chroot/ 下麵進行配置了. 它也將/etc/init.d/named 這個腳本文件也修改了,這裡要注意

[root@crim etc]# pwd
/var/named/chroot/etc
[root@crim etc]# rpm -qa |grep bind
bind-chroot-9.3.4-10.P1.el5_3.1
bind-utils-9.3.4-10.P1.el5_3.1
bind-9.3.4-10.P1.el5_3.1
bind-libs-9.3.4-10.P1.el5_3.1
ypbind-1.19-11.el5
[root@crim etc]#
[root@crim etc]# ls
localtime named.conf rndc.key
[root@crim etc]# pwd
/var/named/chroot/etc
[root@crim etc]# cat named.conf
options {
directory "/var/named/";
};

zone "." IN {
type hint;
file "named.root"; <---named.root google自行下載,放到這個目錄就可以,其實rpm保重也有,但是沒有使用,應該也是可以的
};

zone "0.0.127.in-addr.arpa" IN {
type master;
file "0.0.127.in-addr.arpa.zone";
};

#zone "1.16.172.in-addr.arpa" IN {
#type master;
#file "1.16.172.in-addr.arpa.zone";
#};


zone "localhost" IN {
type master;
file "localhost.zone";
};

zone "openemm.testDomain.com" IN {
type master;
file "openemm.testDomain.com";
};
[root@crim etc]#

[root@crim named]# cat localhost.zone
$TTL 86400
@ IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS @
IN A 127.0.0.1
IN AAAA ::1

[root@crim named]#


[root@crim named]# cat named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
[root@crim named]#

[root@crim named]# cat openemm.testDomain.com
$TTL 604800
openemm.testDomain.com. IN SOA ns1.testDomain.com. hostmaster.testDomain.com. (
;2006103010 ; serial - Many people use year+month+day+integer as a system. Never greater than 2147483647 for a 32 bit processor.
2009071310 ; serial - Many people use year+month+day+integer as a system. Never greater than 2147483647 for a 32 bit processor.
86400 ; refresh - How often secondary servers (in seconds) should check in for changes in serial number. (86400 sec = 24 hrs)
7200 ; retry - How long secondary server should wait for a retry if contact failed.
1209600 ; expire - Secondary server to purge info after this length of time.
604800 ) ; default_ttl - How long data is held in cache by remote servers.
IN A 172.16.1.176 ;XXX.XXX.XXX.XXX - Note that this is the default IP address of the domain.
; I put the web server IP address here so that domain.com points to the same servers as www.domain.com
;
; Name servers for the domain
;
IN NS ns1.testDomain.com.
;
; Mail server for domain
;
IN MX 5 mail ; - Identify "mail" as the node handling mail for the domain. Do NOT specify an IP address!
;
; Nodes in domain
;
IN A 172.16.1.176 ; - Note that this is the IP address of node1
ns1 IN A 172.16.1.176 ; XXX.XXX.XXX.XXX - Optional: For hosting your own primary name server. Note that this is the IP address of ns1
smtp IN A 172.16.1.176;- Identify the IP address for node mail.
pop3 IN A 172.16.1.176;- Identify the IP address for node mail.
mail IN A 172.16.1.176; - Identify the IP address for node mail.
host IN A 172.16.1.176; - Identify the IP address for node mail.
news IN A 172.16.1.176; - Identify the IP address for node mail.
mail IN MX 10 172.16.1.176 ; - Identify the IP address for node mail.
news IN MX 5 172.16.1.176 ; - Identify the IP address for node mail.
;
; Aliases to existing nodes in domain
;
www IN CNAME ns1 ; - Define the webserver "www" to be node1.
[root@crim named]#

然後/etc/init.d/named restart --ok就可以了


4配置 sendmail

yum sendmail相關 package


[root@crim named]# rpm -qa |grep sendmail
sendmail-8.13.8-2.el5
sendmail-cf-8.13.8-2.el5
--具體參見opememm的install document.

修改位置:

116 DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
177 INPUT_MAIL_FILTER(`bav', `S=unix:/home/openemm/var/run/bav.sock, F=T')dn l

[root@crim mail]# m4 sendmail.mc sendmail.cf

/etc/init.d/sendmail

這裡要注意一下配置


[root@crim mail]# cat access
# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
Connect:172.16 RELAY <--否則mail發佈出去

[root@crim mail]#

5 yum mysql

6 rpm 安裝 openemm

按照文檔內容作就可以了!



2009年7月9日星期四

ORACLE 如何知道一个对象占用空间情况?

select segment_name,segment_type,bytes/1024/1024 from dba_segments where owner='SYSTEM' order by bytes desc

select segment_type, sum(bytes)/1024/1024 from dba_segments where tablespace_name='AA' group by segment_type;

select bytes/1024/1024 sizeM, owner, segment_name
from dba_segments
where tablespace_name = 'DD'
and segment_type = 'TABLE' order by sizeM desc;

ORACL E ASM 环境下添加disk

第一步,在服务器上添加相应的存储的映射
第二步, format
fdisk /dev/sdk
第三部 Create Disk U25
oracleasm createdisk U25 /dev/sdk1
Marking disk "/dev/sdk1" as an ASM disk: [ OK ]
[root@oracle01 init.d]# ./oracleasm listdisks;
U02
U03
U04
U05
U07
U15
U16
U25 <--Here!! [root@oracle01 init.d]# 另一个ORACLE node 同步 [root@oracle02 init.d]# ./oracleasm Usae: ./oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status} [root@oracle02 init.d]# ./oracleasm scandisks Scanning system for ASM disks: [ OK ] --时间要久一点-- [root@oracle02 init.d]# [root@oracle02 init.d]# [root@oracle02 init.d]# ./oracleasm listdisks U02 U03 U04 U05 U07 U15 U16 U25 --这里看到成功了 我们这里用EM添加diskgroup 中的disk 从 Log中找到 一下内容 Thu Jul 09 14:50:20 2009 SQL> ALTER DISKGROUP U05 ADD DISK 'ORCL:U25' SIZE 102398 M
NOTE: Assigning number (4,0) to disk (ORCL:U25)
NOTE: requesting all-instance membership refresh for group=4
NOTE: initializing header on grp 4 disk U25
NOTE: cache opening disk 0 of grp 4: U25 label:U25
NOTE: requesting all-instance disk validation for group=4

[oracle@oracle01 ~]$ asmcmd
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Name
MOUNTED EXTERN N 512 4096 1048576 50244 12876 0 12876 0 U02/
MOUNTED EXTERN N 512 4096 1048576 24644 0 0 0 0 U03/
MOUNTED EXTERN N 512 4096 1048576 51199 10994 0 10994 0 U04/
MOUNTED EXTERN Y 512 4096 1048576 153597 101428 0 101428 0 U05/
MOUNTED EXTERN N 512 4096 1048576 5115 4013 0 4013 0 U07/
ASMCMD>

当然 sqlpols 也是可以的


col name format a20
col path format a20
col mode_status a20
SQL> select name, path, mode_status, state, disk_number from v$asm_disk;

NAME PATH MODE_STATUS STATE DISK_NUMBER
-------------------- -------------------- --------------------- ------------------------ -----------
ORCL:U04 ONLINE NORMAL 2
ORCL:U05 ONLINE NORMAL 3
U02 ORCL:U02 ONLINE NORMAL 0
U03 ORCL:U03 ONLINE NORMAL 0
U07 ORCL:U07 ONLINE NORMAL 0
U15 ORCL:U15 ONLINE NORMAL 1
U16 ORCL:U16 ONLINE NORMAL 2
U25 ORCL:U25 ONLINE NORMAL 0


SQL> select name,total_mb,free_mb from v$asm_diskgroup;

NAME TOTAL_MB FREE_MB
-------------------- ---------- ----------
U02 50244 12876
U03 24644 0
U04 51199 10994
U05 153597 101295
U07 5115 4013

2009年7月5日星期日

一周twitter上扯得淡(27/06/2009--06/06/2009)

  1. Risk to a company come in different forms, and they are not all computer related.
  2. 周董的 不能说的秘密 飙琴那段如果跟 legend of 1900 比还是单薄了些
  3. 好的软件就是再使用的时候有不断的惊喜
  4. evaluating the culture of an organization is very important when assessing an organization's security posture
  5. ITIL focus is more towards internal service level agreements between the IT department and the "customers" it servess.
  6. 还是这个browser分布靠谱些 http://gs.statcounter.com/ 微软IE浏览器的市场份额至今年六月已跌破60%为59.49%,而火狐浏览器的市场份额则持续攀升,目前已超过30%至30.33%。
  7. 琵琶这东西听起来是有杀气,要不说是从匈奴传过来的呢
  8. 关注林海是从 陌生人的来信 中的那个 琵琶语 开始的
  9. 飙琴的那个曲子叫
  10. RT @jixin 同败!>> RT @zuodao: 我被《男人装》七月号的封面彻底打败了http://twitpic.com/95560 //XD
  11. RT @cnblogs_news Firefox 3.5正式的发布后的24小时里下载量就突破了500万次,不仅巩固了自己的原有阵地还开拓了新的市场,而IE的市场份额却一跌再跌,由5月份的62.09%跌至59.49%,这也是IE首次跌破60%。
  12. KMplayer不錯,終於有聲音了
  13. download一個Tom大師的視頻, 沒有聲音,趕上默片了,急啊
  14. 終於想明白了,原來twitter實現了從website獲取資料從pull到push得功能.雖然形式變了,極大的方便了人獲取知識,我真夠愚鈍的.
  15. RT @jeffz_cn 在实践中人们发现OO对于生产力的提高并不能达到他们的预期,于是又把关注力分了一点给比OO要早得多的FP上。于是在2000年后FP又得以抬头,有的语言加入了FP的能力(C#),拥有 FP能力的语言得到宠幸(Py,Rb,JS),如Haskell这样原...
  16. 技术真是一条不归路啊
  17. following @Sun4Startups @oraclemix sun oracle 的开发者的twitter
  18. Mr. Kerckhoffs stated that no algorithm should be kept secret; only the key should be the secret component. 对于应用来说,business是key 还是 技术,或者反之?
  19. RT @Linux Welcome to Twitter, @Microsoft !
  20. Tokyo Cabinet研究中
  21. RT @chndonny “对于用户需求,请记住,我们永远是发现者,而不是创造者。”俞军说。
  22. 以后再遇到惊诧的事用 无语表示
  23. firefox3.5没觉得多悬乎,继续干活
  24. 准备安装一下firefox3.5, 看吵吵的那么厉害,手痒了
  25. RT @chndonny LZ:你看我的头像牛B么? 沙发:像。
  26. 中国现在是否在囤积大宗商品和原材料 http://bit.ly/jJNiZ 有点意思了
  27. 还是infoQ的地道一些
  28. Youku的視頻好像有一個ip pool,每段的ip不同,給下載帶來極大的不方便
  29. downloadhelper 相當不錯的firefox插件
  30. 妈妈永远不嫌孩子的粪尿血脓呕吐物肮脏。任何人对他/她心爱的人也是。--李碧华 http://bit.ly/12KL3g
  31. RT @csdncto RT @belltoy 中国网络审查 - Google Docs http://ff.im/-4Eely //清晰而有力 //强文
  32. RT @milkr RT @rtmeme: RT @virushuo: 原来上海倒的那个楼是一个巨大的地动仪啊,准确的测出了四川地震。 /// 还是霍大师强...//也有可能是蝴蝶效应吧
  33. http://open.taobao.com/ 这么慢啊,常态还是特殊情况?
  34. 黃家駒逝世16周年紀念日 http://bit.ly/kLeyl
  35. google Page Speed http://bit.ly/Gst87
  36. 汪峰的《怒放的生命》给劲!
  37. RAC各个node之间通讯的成本也不低
  38. RT @aleksoft [分享]春哥教 by @hecaitou http://www.hecaitou.net/?p=... 陈小春在内地巨火。春哥,纯爷们!
  39. RT @NanZhou 郴州:列车相撞3死60余人伤: 29日2时34分许,在湖南郴州站K9017次客车与刚启动出站的K9063次客车机车发生侧面冲突,K9017次机车及机后1-5位车辆、K9063次机车及机后1-2位车辆脱轨。 http://bit.ly/m9rpR 风水?
  40. @hammer_ham 当然是医生了
  41. 不让喝coffee太痛苦了
  42. 百度大牛走了,是不是預示著搜索引擎技術到了一個平臺期?基於平臺的應用開始或者已經發力了?
  43. RT @karlzheng RT @Fenng: "选对一个人,会大大提升团队的“战斗力”,而选错一个人,会给团队带来可能很严重的“伤害”。" 这话,我也说过,看来...所见略同 :) FYI: http://www.baiduer.com.cn/?...//同意,有过切肤之痛啊
  44. RT @karlzheng RT @williamlong: 转载:《我是一个不喜欢看AV的人》: 作者不详 我是一个极其讨厌AV和看AV的人。黄色产物,如同洪水猛兽,毒害着年轻一代,这是多么不堪的现状!当然,我也看过,每当夜.. http://bit.ly/ZebfE
  45. RT @csdncto 看世间悲欢冷暖 让人心酸的图片 http://bit.ly/6MjmF //苦难的中国
  46. 找到了《第七封信 情书》
  47. 特别是那段钢琴的前奏,一直往你心里钻。
  48. 海角7号的主体曲真是动人心魄啊
  49. @NinGoo http://www.itouchtw.com/fir... 可以訪問的話,我用的這個
  50. RT @liuyan妓:女的,卖艺不卖身,不是性工作者。伎:男的,工作性质与妓相同。娼:是出卖肉体的,是下九流,同时也可能卖艺,但一定是性工作者。后来,“娼”把“妓”这个字给糟蹋了,现在,“妓”又把“小姐”这个词给糟蹋了。//我又文盲了
  51. N多年沒有正經聽過音樂了,在聽MJ響起了中學時代了
  52. @jixin 有2B说迈克尔·杰克逊支持慈善是作秀。我的回答是:一个丑陋的人只能看到丑陋。就算白雪公主在他面前, 他也会认为是杨二车娜姆扮的。杰克逊独自支持39个慈善救助基金会,是全世界以个人名义捐助慈善事业最多的人。——宋石男 http://is.gd/1ewfe

2009年7月2日星期四

Oracle Provides robust tools for data repair

Oracle Provides robust tools for data repair:
RMAN -- physical media loss or corruptions
Flashback -- logical errors
Data Guard -- physical or logical problems

原來一直很模糊,現在清晰了