MQ

Wesley13
• 阅读 665

mq

MQ安装---linux

MQ_V9.0.3_TRIAL_CDR_LNX_ON_X86_64.tar.gz

创建mqm用户

tar -xf MQ_V9.0.3_TRIAL_CDR_LNX_ON_X86_64.tar.gz

切换至解压后的目录:

cd MQServer

授权:

./mqlicense.sh -text_only

再选择1接受授权。

安装:

rpm -ivh MQSeriesRuntime-6.0.0-0.i386.rpm

rpm -ivh MQSeriesSDK-6.0.0-0.i386.rpm

rpm -ivh MQSeriesJava-6.0.0-0.i386.rpm

rpm -ivh MQSeriesClient-6.0.0-0.i386.rpm

rpm -ivh MQSeriesSamples-6.0.0-0.i386.rpm

rpm -ivh MQSeriesServer-6.0.0-0.i386.rpm

rpm -ivh MQSeriesMan-7.5.0-2.x86_64.rpm

rpm -ivh MQSeriesMsg_Zh_CN-7.5.0-2.x86_64.rpm

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

在服务器和客户端机器上安装 Websphere MQ V7.0.1。

这两台机器上应有属于 mqm 组的 mqm 和 mqtest 用户。

两台机器上 mqm 和 mqtest 的用户 id 和组 id 应该是相同的。

机器 1:

id mqm: uid=301(mqm), gid=301(mqm)

id mqtest: uid=501(mqtest), gid=301(mqm)

机器 2:

id mqm: uid=301(mqm), gid=301(mqm)

id mqtest: uid=501(mqtest), gid=301(mqm)

在 HP-UX 上安装 NFS

本例中,NFS 服务器为:hpate1,导出路径为:/HA,NFS 客户端为:hostile.

HP-UX上的 NFS 服务器配置

1》以 root 身份登录服务器并进行配置。

2》编辑文件 /etc/rc.config.d/nfsconf,将 NFS_SERVER 和 START_MOUNTD 的值改为 1:

#more /etc/rc.config.d/nfsconf

NFS_SERVER=1

START_MOUNTD=1

3》启动 nfs.server 脚本:

/sbin/init.d/nfs.server start

4》编辑 /etc/exports 为每一个将要导出的目录添加一个条目:

# more /etc/exports

/HA

5》强迫 NFS daemon nfsd 重读 /etc/exports :

#/usr/sbin/exportfs -a

6》使用 showmount -e 验证 NFS 的安装:

# showmount -e

export list for hpate1:

HA (everyone)

HP-UX 上的 NFS 客户端设置

1》以 root 身份登录。

2》检查 NFS 客户机上您将要导入的目录是否为空或不存在。

3》如果目录不存在,创建一个目录:

#mkdir /HA

4》添加一个条目 /etc/fstab 这样文件系统将会在启动时自动安装:

nfs_server:/nfs_server_dir /client_dir nfs defaults 0 0

# more /etc/fstab

hpate1:/ha /ha NFS DEFAULTS 0 0

5》安装远程文件系统:

#/usr/sbin/mount -a

6》验证 NFS 安装:

# mount -v

hpate1:/HA on /HA type nfs rsize=32768,wsize=32768,NFSv4,dev=4000004

on Tue Aug 3 14:15:18 2010

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

执行 amqmfsck 以验证文件系统与 POSIX 的标准是否保持一致

本例中: Server1 = stallion.in.ibm.com 和 Server2 = saigon.in.ibm.com。

1》执行不带任何选项的 amqmfsck 来检查基本锁定情况:

su - mqtest

export PATH=/opt/mqm/bin:$PATH

On Server1:

$ amqmfsck /HA/mqdata

The tests on the directory completed successfully.

On Server2:

$ amqmfsck /HA/mqdata

The tests on the directory completed successfully.

2》执行带有 -c 选项的 amqmfsck 来测试写入目录:

On Server1:

$ amqmfsck -c /HA/mqdata

Start a second copy of this program with the same parameters on another server.

Writing to test file.

This will normally complete within about 60 seconds.

.................

The tests on the directory completed successfully.

On Server2:

$ amqmfsck -c /HA/mqdata

Start a second copy of this program with the same parameters on another server.

Writing to test file.

This will normally complete within about 60 seconds.

.................

The tests on the directory completed successfully.

3》在两台机器上同步执行带有 -w 选项的 amqmfschk,检测等待同时释放对目录的锁定:

On Server1:

$ $ amqmfsck -wv /HA/mqdata

System call: stat("/HA/mqdata",&statbuf)

System call: statvfs("/HA/mqdata")

System call: fd = open("/HA/mqdata/amqmfsck.lkw",O_CREAT|O_RDWR,0666)

System call: fchmod(fd,0666)

System call: fstat(fd,&statbuf)

System call: fcntl(fd,F_SETLK,F_WRLCK)

Start a second copy of this program with the same parameters on another server.

File lock acquired.

Press Enter or terminate this process to release the lock.

On Server2:

$ amqmfsck -wv /HA/mqdata

System call: stat("/HA/mqdata",&statbuf)

System call: statvfs("/HA/mqdata")

System call: fd = open("/HA/mqdata/amqmfsck.lkw",O_CREAT|O_RDWR,0666)

System call: fchmod(fd,0666)

System call: fstat(fd,&statbuf)

System call: fcntl(fd,F_SETLK,F_WRLCK)

Waiting for the file lock.

System call: fcntl(fd,F_SETLK,F_WRLCK)

Waiting for the file lock.

System call: fcntl(fd,F_SETLK,F_WRLCK)

Waiting for the file lock.

System call: fcntl(fd,F_SETLK,F_WRLCK)

Waiting for the file lock.

System call: fcntl(fd,F_SETLK,F_WRLCK)

Waiting for the file lock.

System call: fcntl(fd,F_SETLK,F_WRLCK)

Waiting for the file lock.

System call: fcntl(fd,F_SETLK,F_WRLCK)

Waiting for the file lock.

System call: fcntl(fd,F_SETLK,F_WRLCK)

Waiting for the file lock.

System call: fcntl(fd,F_SETLK,F_WRLCK)

File lock acquired.

Press Enter or terminate this process to release the lock.

System call: close(fd)

File lock released.

The tests on the directory completed successfully.

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

安装一个多实例队列管理器

本例中,Server1 = stallion.in.ibm.com 和 Server2 = saigon.in.ibm.com.

Server 1

1》在共享文件系统中创建日志和 qmgrs 目录:

# mkdir logs

# mkdir qmgrs

# chown -R mqm:mqm /HA

# chmod -R ug+rwx /HA

2》创建队列管理器:

# crtmqm -ld /HA/logs -md /HA/qmgrs -q QM1

WebSphere MQ queue manager created.

Directory '/HA/qmgrs/QM1' created.

Creating or replacing default objects for QM1.

Default objects statistics : 65 created. 0 replaced. 0 failed.

Completing setup.

Setup completed.

3》从 Server1 中复制队列管理器配置细节:

# dspmqinf -o command QM1

4》将上述命令复制到 Notepad。输出格式如下:

addmqinf -s QueueManager -v Name=QM1 -v Directory=QM1 -v Prefix=/var/mqm -v

DataPath=/HA/qmgrs/QM1

Server 2

1》粘帖步骤 4 保存在 Notepad 中的输出命令:

# addmqinf -s QueueManager -v Name=QM1 -v Directory=QM1 -v Prefix=/var

/mqm -v DataPath=/HA/qmgrs/QM1

WebSphere MQ configuration information added.

2》启动 Server 1 中队列管理器的活动实例:

# strmqm -x QM1

WebSphere MQ queue manager 'QM1' starting.

5 log records accessed on queue manager 'QM1' during the log replay phase.

Log replay for queue manager 'QM1' complete.

Transaction manager state recovered for queue manager 'QM1'.

WebSphere MQ queue manager 'QM1' started.

3》启动 Server 2 中队列管理器的备用实例:

# strmqm -x QM1

WebSphere MQ queue manager QM1 starting.

A standby instance of queue manager QM1 has been started.

The active instance is running elsewhere.

4》使用 dspmq -x 验证安装:

On Server1 (stallion)

# dspmq -x

QMNAME(QM1) STATUS(Running)

INSTANCE(stallion) MODE(Active)

INSTANCE(saigon) MODE(Standby)

On Server2 (saigon)

# dspmq -x

QMNAME(QM1) STATUS(Running as standby)

INSTANCE(stallion) MODE(Active)

INSTANCE(saigon) MODE(Standby)

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

创建一个客户端自动重连接安装

本例中,Server1 = lins.in.ibm.com 和 Server2 = gtstress42.in.ibm.com。在 Server 1:

1》使用 defpsist(yes) 创建一个名为 Q 的本地队列。

2》创建一个名为 CHL 的 svrconn 通道。

3》启动一个运行在 9898 端口的监听器:

# runmqsc QM1

5724-H72

(C) Copyright IBM Corp. 1994, 2009. ALL RIGHTS RESERVED.

Starting MQSC for queue manager QM1.

def ql(Q) defpsist(yes)

1 : def ql(Q) defpsist(yes)

AMQ8006: WebSphere MQ queue created.

define channel(CHL) chltype(SVRCONN) trptype(tcp) MCAUSER('mqm') replace

2 : define channel(CHL) chltype(SVRCONN) trptype(tcp) MCAUSER('mqm') replace

AMQ8014: WebSphere MQ channel created.

end

# runmqlsr -m SAMP -t tcp -p 9898 &

[1] 26866

]# 5724-H72

(C) Copyright IBM Corp. 1994, 2009. ALL RIGHTS RESERVED.

4》在 Server 1 上把 MQSERVER 设置为变量:

Export MQSERVER=/tcp/<server1(port), server2(port)>

For example: export MQSERVER=CHL/TCP/'9.122.163.105(9898),9.122.163.77(9898)'

5》在 Server 2 上,启动端口 9898上的一个监听器:

# runmqlsr -m QM1 -t tcp -p 9898 &

[1] 24467

[root@gtstress42 ~]# 5724-H72

(C) Copyright IBM Corp. 1994, 2009. ALL RIGHTS RESERVED.

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

执行客户端自动重连接样例

Server 1

1》调用 amqsphac 样例程序:

# amqsphac Q QM1

Sample AMQSPHAC start

target queue is Q

message < Message 1 >

message < Message 2 >

message < Message 3 >

message < Message 4 >

message < Message 5 >

message < Message 6 >

message < Message 7 >

message < Message 8 >

message < Message 9 >

message < Message 10 >

2》在 Server 1 的另一个窗口中,使用 -is 选项结束队列管理器,这样它将切换到备用队列管理器:

Server 1(new session):

# endmqm -is QM1

WebSphere MQ queue manager 'QM1' ending.

WebSphere MQ queue manager 'QM1' ended, permitting switchover to a standby

3》验证一个切换是否已发生:

On Server2:

# dspmq -x -o standby

QMNAME(QM1) STANDBY(Permitted)

INSTANCE(gtstress42.in.ibm.com) MODE(Active) instance.

4》该连接将断开,且备用队列管理器中出现重连接:

On Server 1

16:12:28 : EVENT : Connection Reconnecting (Delay: 57ms)

10/06/2010 04:12:35 PM AMQ9508: Program cannot connect to the queue manager.

10/06/2010 04:12:35 PM AMQ9999: Channel program ended abnormally.

16:12:37 : EVENT : Connection Reconnecting (Delay: 0ms)

10/06/2010 04:12:37 PM AMQ9508: Program cannot connect to the queue manager.

10/06/2010 04:12:37 PM AMQ9999: Channel program ended abnormally.

16:12:37 : EVENT : Connection Reconnected

16:12:38 : EVENT : Connection Broken

message < Message 11 >

message < Message 12 >

message < Message 13 >

message < Message 14 >

message < Message 15 >

message < Message 16 >

message < Message 17 >

message < Message 18 >

message < Message 19 >

message < Message 20 >

message < Message 21 >

message < Message 22 >

5》在 Server 1 上运行样例程序 amsghac,得到以下信息:

# amqsghac Q SAMP

Sample AMQSGHAC start

10/06/2010 04:14:33 PM AMQ9508: Program cannot connect to the queue manager.

10/06/2010 04:14:33 PM AMQ9999: Channel program ended abnormally.

message < Message 1 >

message < Message 2 >

message < Message 3 >

message < Message 4 >

message < Message 5 >

message < Message 6 >

message < Message 7 >

message < Message 8 >

message < Message 9 >

message < Message 10 >

message < Message 11 >

message < Message 12 >

message < Message 13 >

message < Message 14 >

message < Message 15 >

message < Message 16 >

message < Message 17 >

message < Message 18 >

message < Message 19 >

message < Message 20 >

message < Message 21 >

message < Messagee 22 >

点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Jacquelyn38 Jacquelyn38
2年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
Wesley13 Wesley13
2年前
Java获得今日零时零分零秒的时间(Date型)
publicDatezeroTime()throwsParseException{    DatetimenewDate();    SimpleDateFormatsimpnewSimpleDateFormat("yyyyMMdd00:00:00");    SimpleDateFormatsimp2newS
Stella981 Stella981
2年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Wesley13 Wesley13
2年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
2年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
2年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
2年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
3个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这