我正在尝试使用 python 和 pymqi 模块设置一个脚本来检查 IBM MQ 中的统计信息。问题是连接似乎没有使用我在脚本中提供的用户名。看起来用户正在尝试使用执行脚本的用户的用户名。在测试连接时,我使用了一个像这样的小脚本:
import pymqi
queue_manager = "MYQMGR"
channel = "CHNL.SRV01"
host = "host.to.connect.to.example.net"
port = "1444"
conn_info = "%s(%s)" % (host, port)
user = 'mq-user'
password = 'mq-user-pass'
qmgr = pymqi.connect(queue_manager, channel, conn_info, user, password)
qmgr.disconnect()
假设脚本由名为“shell-user”的 linux 用户执行。然后在队列管理器的日志中,它说“shell-user”正在尝试连接,而不是我在脚本中写的“mq-user”。
错误消息如下所示:
Traceback (most recent call last): File "./test_conn.py", line 25, in <module>
qmgr = pymqi.connect(queue_manager, channel, conn_info, user, password) File "/usr/lib64/python2.7/site-packages/pymqi/__init__.py", line 2604, in connect
qmgr.connect_tcp_client(queue_manager or '', CD(), channel, conn_info, user, password) File "/usr/lib64/python2.7/site-packages/pymqi/__init__.py", line 1447, in connect_tcp_client
self.connect_with_options(name, cd, user=user, password=password) File "/usr/lib64/python2.7/site-packages/pymqi/__init__.py", line 1429, in connect_with_options
raise MQMIError(rv[1], rv[2]) pymqi.MQMIError: MQI Error. Comp: 2, Reason 2035: FAILED: MQRC_NOT_AUTHORIZED
我正在使用 pymqi 1.8.0 和 MQSeriesClient 8.0.0-8。我已经寻找了几天的解决方案。有谁知道如何处理这个问题?
编辑:
我们要连接的队列管理器的版本是 8.0.0.8。
这是我们从队列管理器得到的错误消息:
2/1/2019 09:32:45 - Process(8176.400417) User(abcdefg-1234) Program(amqrmppa.exe)
Host(mq-host-01) Installation(Installation1)
VRMF(8.0.0.8) QMgr(MYQMGR)
AMQ9557: Queue Manager User ID initialization failed for 'shell-user'.
EXPLANATION:
The call to initialize the User ID 'shell-user' failed with CompCode 2 and Reason
2035. If an MQCSP block was used, the User ID in the MQCSP block was
'mq-user'.
ACTION:
Correct the error and try again.