redhat 6用udev设置multipath盘的权限

1

Posted on by

   在操作系统redhat 6上,重启multipath服务,盘的权限就变root了,需要用udev绑定设置权限。

查看设备

[root@oradbca ~]# dmsetup ls 
data01  (253:2)
crs03   (253:3)
VG0-LV_ROOT     (253:6)
crs02   (253:1)
crs01   (253:0)
data03  (253:5)
data02  (253:4)

 

配置参数

[root@oradbca ~]# cat /etc/udev/rules.d/12-dm-permissions.rules 
ENV{DM_NAME}=="crs01", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="crs02", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="crs03", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="data01", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="data02", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="data03", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"

 

重启服务

	service multipath restart

 

查看权限

[root@oradbca ~]# ll /dev/dm-*
brw-rw---- 1 grid asmadmin 253, 0 Jul 23 14:26 /dev/dm-0
brw-rw---- 1 grid asmadmin 253, 1 Jul 23 14:26 /dev/dm-1
brw-rw---- 1 grid asmadmin 253, 2 Jul 13 03:48 /dev/dm-2
brw-rw---- 1 grid asmadmin 253, 3 Jul 23 14:26 /dev/dm-3
brw-rw---- 1 grid asmadmin 253, 4 Jul 13 03:48 /dev/dm-4
brw-rw---- 1 grid asmadmin 253, 5 Jul 23 14:26 /dev/dm-5
brw-rw---- 1 root disk     253, 6 Jul 13 03:04 /dev/dm-6

 

贴multipath配置文件:

blacklist {
        devnode "^(sda)"
#       devnode "^(ram|raw|loop|fd|md|sr|scd|st|sdh|sdq)[0-9]*"
        devnode "^cciss.*"
}

## Use user friendly names, instead of using WWIDs as names.
defaults {
        user_friendly_names yes
        max_fds             max
        queue_without_daemon no  
        flush_on_last_del yes 
        dev_loss_tmo infinity
        fast_io_fail_tmo 5
}


devices {
        device {
                vendor                  "NetAPP"
                product                 "FAS2240"
                path_grouping_policy    group_by_prio
                features                "3 queue_if_no_path pg_init_retries 50"
                prio                    "ontap"
                getuid_callout          "/lib/udev/scsi_id -g -u -d /dev/%n"
                path_checker            tur
                path_selector           "round-robin 0"
                hardware_handler        "0"
                failback                imediate
                rr_weight               uniform
                rr_min_io               128
        }
}




multipaths {
        multipath {
                wwid                    360a98000426b5953423f456e30774c61
                alias                   crs01
        }
        multipath {
                wwid                    360a98000426b5953423f456e30774c63
                alias                   crs02
        }
        multipath {
                wwid                    360a98000426b5953423f456e30774c65
                alias                   crs03
        }
                multipath {
                wwid                    360a98000426b5953423f456e30774c67
                alias                   data01
        }
                multipath {
                wwid                    360a98000426b5953423f456e30774c69
                alias                   data02
        }
                multipath {
                wwid                    360a98000426b5953423f456e30774c6b
                alias                   data03
        }
}

GoldenGate cannot acquire password for jmxUser

0

Posted on by

版本:

Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100 
Linux, x64, 64bit (optimized), Oracle 10g on Oct  4 2011 23:50:20

 

  在启动agent的时候,报密码不对,报错如下:

2014-06-18 14:50:33  WARNING OGG-01689  Oracle GoldenGate Manager for Oracle, mgr.prm:  Thread: agentRegistration, Message: MBeansContainerImpl.java::::::1266 javax.security.sasl.SaslException: DIGEST-MD5: cannot acquire password for jmxUser in realm : monitorservice.
2014-06-18 14:51:33  WARNING OGG-01689  Oracle GoldenGate Manager for Oracle, mgr.prm:  Thread: agentRegistration, Message: MBeansContainerImpl.java::::::1266 javax.security.sasl.SaslException: DIGEST-MD5: cannot acquire password for jmxUser in realm : monitorservice.
2014-06-18 14:52:33  WARNING OGG-01689  Oracle GoldenGate Manager for Oracle, mgr.prm:  Thread: agentRegistration, Message: MBeansContainerImpl.java::::::1266 javax.security.sasl.SaslException: DIGEST-MD5: cannot acquire password for jmxUser in realm : monitorservice.

 

解决方法为:

1.通过pw_agent_util.sh来更新密码

pw_agent_util.sh -updateServerJMX

 

2.修改 <OGG_HOME>/cfg/Config.properties 这个文件

在配置文件里用户名是jmxUser   其实service端的用户名为jmxuser 

jmxUser 修改为jmxuser  再重启下mgr就可以了。

GoldenGate Error loading function jvm from JNI_GetCreatedJavaVMs

0

Posted on by

版本:

Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100 
Linux, x64, 64bit (optimized), Oracle 10g on Oct  4 2011 23:50:20

 

ogg在配置monitor agent时报错:

2014-06-18 14:38:59  INFO    OGG-00983  Oracle GoldenGate Manager for Oracle, mgr.prm:  Manager started (port 7809).
2014-06-18 14:38:59  INFO    OGG-01227  Oracle GoldenGate Manager for Oracle, mgr.prm:  Waiting for connection on port 7809 ..
2014-06-18 14:38:59  INFO    OGG-01338  Oracle GoldenGate Manager for Oracle, mgr.prm:  mgr: The Network Server service was started successfully.
2014-06-18 14:38:59  INFO    OGG-01338  Oracle GoldenGate Manager for Oracle, mgr.prm:  mgr: The Java VM service was started successfully.
2014-06-18 14:38:59  INFO    OGG-01338  Oracle GoldenGate Manager for Oracle, mgr.prm:  mgr: The ProcessManager service was started successfully.
2014-06-18 14:38:59  INFO    OGG-01338  Oracle GoldenGate Manager for Oracle, mgr.prm:  mgr: The Watchdog service was started successfully.
2014-06-18 14:38:59  INFO    OGG-00975  Oracle GoldenGate Manager for Oracle, mgr.prm:  Manager service started successfully.
2014-06-18 14:39:00  ERROR   OGG-01122  Oracle GoldenGate Manager for Oracle, mgr.prm:  Error opening module jvm - Success].
2014-06-18 14:39:00  ERROR   OGG-01668  Oracle GoldenGate Manager for Oracle, mgr.prm:  PROCESS ABENDING.
2014-06-18 14:39:00  INFO    OGG-00975  Oracle GoldenGate Manager for Oracle, mgr.prm:  Stopping Network Server service..
2014-06-18 14:39:01  INFO    OGG-00975  Oracle GoldenGate Manager for Oracle, mgr.prm:  Stopping Network Server service..
2014-06-18 14:39:01  INFO    OGG-00975  Oracle GoldenGate Manager for Oracle, mgr.prm:  The Network Server service was stopped successfully.
2014-06-18 14:39:01  INFO    OGG-00975  Oracle GoldenGate Manager for Oracle, mgr.prm:  Stopping Dispatcher service..
2014-06-18 14:39:02  INFO    OGG-00975  Oracle GoldenGate Manager for Oracle, mgr.prm:  The Dispatcher service was stopped successfully.
2014-06-18 14:39:02  INFO    OGG-00975  Oracle GoldenGate Manager for Oracle, mgr.prm:  Stopping Watchdog service..
2014-06-18 14:39:02  INFO    OGG-00975  Oracle GoldenGate Manager for Oracle, mgr.prm:  The Watchdog service was stopped successfully.
2014-06-18 14:39:02  INFO    OGG-00975  Oracle GoldenGate Manager for Oracle, mgr.prm:  Stopping JavaVMService service..
2014-06-18 14:39:02  INFO    OGG-00975  Oracle GoldenGate Manager for Oracle, mgr.prm:  JavaVMService::stop() shutdownClass.
2014-06-18 14:39:02  ERROR   OGG-01123  Oracle GoldenGate Manager for Oracle, mgr.prm:  Error loading function jvm from JNI_GetCreatedJavaVMs - ./mgr: undefined symbol: JNI_GetCreatedJavaVMs].
2014-06-18 14:39:02  ERROR   OGG-01668  Oracle GoldenGate Manager for Oracle, mgr.prm:  PROCESS ABENDING.

看错误是jvm起不来报的错,通过查找资料,基本是JAVA_HOME的问题

1.JAVA_HOME 没有配置或者配置目录不对

2.jvm的lib目录没有配置,如操作系统是64位的,jvm也必须为64位的

 

官方解决方案:

In case of the 64 bit Monitor Jagent, your LD_LIBRARY_PATH must be pointing to the 64-bit libjvm.so, not the 32-bit libjvm.so.

To locate the correct one, check each of the libjvm.so using 'file' to determine which is 64-bit:

In the following example we are running on SPARC Solaris:



1. Find the correct Java directory 

 

echo $JAVA_HOME
/usr/jdk/jdk1.6.0_18





2. Search for available libjvm.so files 

 

cd $JAVA_HOME
find ./ -name libjvm.so
/usr/jdk/jdk1.6.0_18/jre/lib/sparcv9/server/libjvm.so
/usr/jdk/jdk1.6.0_18/jre/lib/sparc/client/libjvm.so
/usr/jdk/jdk1.6.0_18/jre/lib/sparc/server/libjvm.so
/usr/jdk/jdk1.6.0_18/jre/lib/sparc/libjvm.so



3. Verify with 'file' if those files are 32 bit or 64 bit libraries:

 

file /usr/jdk/jdk1.6.0_18/jre/lib/sparcv9/server/libjvm.so
/usr/jdk/jdk1.6.0_18/jre/lib/sparcv9/server/libjvm.so: ELF 64-bit MSB dynamic lib SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
file /usr/jdk/jdk1.6.0_18/jre/lib/sparc/server/libjvm.so
/usr/jdk/jdk1.6.0_18/jre/lib/sparc/server/libjvm.so: ELF 32-bit MSB dynamic lib SPARC32PLUS Version 1, V8+ Required, dynamically linked, not stripped, no debugging information available



4. Then set your JAVA_HOME, PATH with JAVA_HOME/bin and LD_LIBRARY_PATH pointing to the correct 64-bit libjvm.so:

 

export JAVA_HOME=/usr/jdk/jdk1.6.0_18
export PATH=$JAVA_HOME/bin:$PATH
export LD_LIBRARY_PATH=/usr/jdk/jdk1.6.0_18/jre/lib/sparcv9/server:$LD_LIBRARY_PATH



5. Then, after the environment variables are set, using the same session, go to GGSCI and start the MANAGER with ENABLEMONITORAGENT set in the GLOBALS file.

 

 

 

 

postgres Synchronous replication 搭建

0

Posted on by

     Synchronous replication 其实就是同步复制,即意味着直到被主服务器和复制服务器均接收完事务时,事务才会返回给应用程序。这点就确保了即便在主服务器永久下线的情况下,任何已提交事务的数据都不会丢失。

    其实同步搭建和异步搭建只需要在主库上和备库上新增一个配置文件就可以了。

    异步同步搭建链接:postgres streaming replication 搭建

 

主库:

在postgresql.conf配置文件中新增:

synchronous_standby_names = 'mydb_standby'

 

备库:

在recovery.conf 配置文件修改:

primary_conninfo = 'host=192.168.1.11 port=5432 user=repuser password=repuser  keepalives_idle=60 keepalives_interval=5 keepalives_count=5'
​修改成
primary_conninfo = 'host=192.168.1.11 port=5432 user=repuser password=repuser application_name=mydb_standby keepalives_idle=60 keepalives_interval=5 keepalives_count=5'

注意:

      若开启同步复制,若一个 standby 节点 crash ,而又没有其它standby 节点顶上,那么主库上的所有操作将会被 HANG 住,直到备库恢复;主库才恢复正常,如果是很重要的业务,建议至少配置两个 standby 节点,提高高可用性。

 

 

 

postgresql 密码文件pgpass配置

0

Posted on by

远程备份或者登录时总要手工输入密码,导致效率很低。

postgresql可以通过密码文件来实现”无钥验证“。

在用户的根目录下,需要创建一个.pgpass文件,并将权限设置为0600,就可以实现了。

 

文件的格式如下:

hostname:port:database:username:password

 

演示:

1.psql登入

[postgres@oradbca ~]$ cd
[postgres@oradbca ~]$ touch .pgpass
[postgres@oradbca ~]$ vi .pgpass 
192.168.1.11:5432:postgres:postgres:postgres
[postgres@oradbca ~]$ chmod 600 .pgpass 
[postgres@oradbca ~]$ psql -h 192.168.1.11 -p 5432 -d postgres -U postgres
psql (9.3.4)
Type "help" for help.

postgres=# 

 

2.pg_dump备份

pg_dump -d postgres -h 192.168.1.11 -p 5532 -U postgres >back.dmp

 

3.pg_basebackup同步

在使用pg_basebackup时需要在.pgpass中增加一行 replication类型的

192.168.1.11:5432:replication:repuser:repuser

[postgres@oradbca ~]$ pg_basebackup -D /u01/pgdata -Fp -Xs -v -P -h 192.168.1.11 -p 5432 -U repuser
transaction log start point: 0/1A000028 on timeline 1
pg_basebackup: starting background WAL receiver
37929/37929 kB (100%), 2/2 tablespaces                                         
transaction log end point: 0/1A0000F0
pg_basebackup: waiting for background process to finish streaming ...
pg_basebackup: base backup completed