星期五, 4月 27, 2018

alias 無法使用多個指令串接解決方法

因為練習Docker, 想要把以下指令串寫成一個alias 命令來一次刪除所有的container
docker ps -a|awk '{print $1}'|grep -v CONTAINER|xargs -n 1 docker rm
但發現bash會認為語法不對, 在stackoverflow 發現以下解法, 將其寫成function (.bashrc)

docrmall() {
docker ps -a|awk '{print $1}'|grep -v CONTAINER|xargs -n 1 docker rm
}

以後只要呼叫 docrmall就可以了!

Syntax error when trying to pipe multiple commands in an alias definition

***
xargs -n 1 : 代表一次用一個值傳給後面的命令當輸入值

Linux 系統 xargs 指令範例與教學


*** update: 發現另外方式更快, 主要是 -q 這個選項可以只輸出id, 不需再去grep

(1) docker rm -f  $(docker ps -aq)
或是
(2) docker ps -aq|xargs docker rm

***

$(    )   --->  取得( ) 內的指令輸出內容

星期三, 4月 18, 2018

find out the number of current using channel

查看channel 目前使用數量 (只會有client mode)
echo 'dis chstatus(*) ALL'|runmqsc your_qmgr_name|grep AMQ8417|wc -l

查看總連線數 (會包含binding mode和client mode)
echo 'dis conn(*) ALL'|runmqsc your_qmgr_name|grep CHANNEL|wc -l



星期二, 4月 17, 2018

DB2 APAR PI47282 needed when using JAVA SDK8 in WebSphere Application Server V8.5.5.9+

DB2 APAR PI47282 needed when using JAVA SDK8 in WebSphere Application Server V8.5.5.9+
http://www-01.ibm.com/support/docview.wss?uid=swg21982343

PI47282: NEW RELEASE OF THE IBM DB2 DRIVER FOR JDBC AND SQLJ (RELEASE 4.19) PROVIDING VARIOUS ENHANCEHMENT
http://www-01.ibm.com/support/docview.wss?uid=swg1PI47282

SqlException: unsupported encoding Cp037 for result set column
Unsupported ccsid, encoding, or locale: "Cp037". ERRORCODE=-4220, SQLSTATE=22021

WAS may get the following error:
Unsupported ccsid, encoding, or locale: "Cp037". ERRORCODE=-4220, SQLSTATE=22021


星期二, 3月 06, 2018

How do you define a MQ trigger monitor service?

How do you define a MQ trigger monitor service?
https://developer.ibm.com/answers/questions/397542/how-do-you-define-a-mq-trigger-monitor-service.html

The following MQSC command defines a trigger monitor service called INIT. It is used to trigger the start of an application to get a message from a queue. WMQ is installed in the default location of "C:\Program Files\Websphere MQ". The name of the initiation queue is "MY.INITQ".
You can add a description [DESCR] within single quotes if you want. 'tm_out' and 'tm_err' define the name of output an error date for this service respectively. These files can be deleted if you feel they have become to large. They will be recreated if needed. The definitions that begin and end with '+' are place holders.
Refer to DEFINE SERVICE for more information on defining a service.
Note: (a) Only customize items in BOLD ITALICS for your environment.
(b) You may customize the STDOUT and STDERR filename and path.
1 - Modify the command for your environment.
2 - Open a command prompt, type: RUNMQSC [Your_Queue_Manager_Name].
3 - Copy and Paste the modified command into the RUNMQSC window press .
DEFINE SERVICE ('INIT') +
DESCR(' ') +
STARTCMD('+MQ_INSTALL_PATH+bin64\runmqtrm') +
STARTARG('-m +QMNAME+ -q MY.INITQ') +
STOPCMD('+MQ_INSTALL_PATH+bin64\amqsstop') +
STOPARG('-m +QMNAME+ -p +MQ_SERVER_PID+') +
STDOUT('C:\Program Files\IBM\WebSphere MQ\errors\tm_out') +
STDERR('C:\Program Files\IBM\WebSphere MQ\errors\tm_err') +
CONTROL(QMGR) +
SERVTYPE(SERVER) +
REPLACE
4 - Type "END" and press .
NOTE: This information was originally in technote #1284004

technote #1284004
Basic process triggering using runmqtrm defined as a service in WebSphere MQ 7.5 and 8.0



What you can purchase with IBM MQ

What you can purchase with IBM MQ
https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.pro.doc/q126140_.htm

Multiplatforms
For IBM MQ for Multiplatforms, the product offering contains the following chargeable components that can be independently purchased:
5724-H72 IBM MQ
IBM MQ (Server)
[V9.0.4 Oct 2017]IBM MQ High Availability Replica (formerly IBM MQ Idle Standby)
IBM MQ Advanced
[V9.0.4 Oct 2017]IBM MQ Advanced High Availability Replica (formerly IBM MQ Advanced Idle Standby)
IBM MQ Advanced for Developers
For the following chargeable components, existing Subscription and Support can be renewed. No new entitlement can be purchased. See the Announcement Letter for more information.
  • IBM MQ Telemetry
  • Advanced Message Security
  • [V9.0.4 Oct 2017]Advanced Message Security High Availability Replica (formerly Advanced Message Security Idle Standby)
  • Managed File Transfer Service
  • [V9.0.4 Oct 2017]Managed File Transfer Service High Availability Replica (formerly Managed File Transfer Service Idle Standby)
  • Managed File Transfer Agent


星期五, 1月 19, 2018

如何知道IHS 是否支援Apache的模組

查看<IHS-install-root>/modules/目錄下的.so檔案, 此目錄下的模組即是IHS有支援的模組。

generate duplicate messages into other queues

MQ: You want to put a message into a queue and you want to generate duplicate messages into other queues


必須使用pub/sub的功能來間接完成

Question

Scenarios that are addressed in this technote:

1) You are using point-to-point (queues) with your putting and getting applications. You want to use WebSphere MQ (WMQ) Pub/Sub under the covers and you do not want your putting and getting applications to be aware of Pub/Sub. That is, the application that puts messages into a queue continues to put messages into a queue, and the getting applications keep getting messages from a queue.

2) You are using point-to-point and you want to create "duplicate" messages that will be stored in queues Q1 and Q2, when the message is put into the queue "DESTINATION"

Answer

This example uses the new concepts of "topic objects" and "topic alias" introduced in MQ V7.
Use MQ Explorer or amqsput sample to put a message to the DESTINATION queue, which in turn publishes the message into the topic T1 and the subscribers SUB1 and SUB2 receive the messages, which are stored in queues Q1 and Q2 respectively.
You could also publish directly into topic T1.
A copy of the message will be placed on Q1 and Q2.

Use runmqsc to define the following objects:

define ql(Q1)
define ql(Q2)
define qalias(DESTINATION) target(T1) targtype(topic)
define topic(T1) topicstr('TOPIC1')
define sub(SUB1) topicstr('TOPIC1') dest(Q1)
define sub(SUB2) topicstr('TOPIC1') dest(Q2)

Example of running amqsput and amqsget:

a) Open 3 windows:
window 1: get messages from queue Q1
amqsget Q1 QMGR

window 2: get messages from queue Q2
amqsget Q2 QMGR

window 3: put a message into the queue DESTINATION
amqsput DESTINATION QMGR
Sample AMQSPUT0 start
target queue is DESTINATION
TEST
Sample AMQSPUT0 end

b) Observe that Q1 and Q2 receive the same message:

amqsget Q1 QMGR
Sample AMQSGET0 start
message <TEST>
no more messages
Sample AMQSGET0 end

amqsget Q2 QMGR
Sample AMQSGET0 start
message <TEST>
no more messages
Sample AMQSGET0 end

c) NOTE: Strictly speaking, the messages received by Q1 and Q2 are NOT truly identical. Even though they will have the same payload (text string 'TEST') and same characteristics, each message will have its own unique message-id.

The following is a browse (using: amqsbcg Queue QMGR) of the messages.

Notice that the only differences in this particular example are the last 2 characters from "MsgId" and CorrelId". In your case, more characters in this field could be different.

Message received by Q1:
  MsgId :    X'414D5120514D5F3730312020202020207064DF4E20003603'
                                                             **
  CorrelId : X'414D5120514D5F3730312020202020207064DF4E20001E08'
                                                             **

Message received by Q2:
  MsgId :    X'414D5120514D5F3730312020202020207064DF4E20003602'
                                                             **
  CorrelId : X'414D5120514D5F3730312020202020207064DF4E20001E0E'
                                                             **

c.1) Message received by Q1

****Message descriptor****

StrucId : 'MD ' Version : 2
Report : 0 MsgType : 8
Expiry : -1 Feedback : 0
Encoding : 546 CodedCharSetId : 437
Format : 'MQSTR '
Priority : 0 Persistence : 0
MsgId : X'414D5120514D5F3730312020202020207064DF4E20003603'
CorrelId : X'414D5120514D5F3730312020202020207064DF4E20001E08'
BackoutCount : 0
ReplyToQ : ' '
ReplyToQMgr : 'QMGR '
** Identity Context
UserIdentifier : 'rivera '
AccountingToken :
X'16010515000000BA1E06D2603C3514885EDBC2EF03000000000000000000000B'
ApplIdentityData : ' '
** Origin Context
PutApplType : '26'
PutApplName : 'QMGR '
PutDate : '20111207' PutTime : '20215396'
ApplOriginData : ' '

GroupId : X'000000000000000000000000000000000000000000000000'
MsgSeqNumber : '1'
Offset : '0'
MsgFlags : '0'
OriginalLength : '-1'

**** Message ****

length - 4 bytes

00000000: 5445 5354 'TEST '

c.2) Message received by Q2

****Message descriptor****

StrucId : 'MD ' Version : 2
Report : 0 MsgType : 8
Expiry : -1 Feedback : 0
Encoding : 546 CodedCharSetId : 437
Format : 'MQSTR '
Priority : 0 Persistence : 0
MsgId : X'414D5120514D5F3730312020202020207064DF4E20003602'
CorrelId : X'414D5120514D5F3730312020202020207064DF4E20001E0E'
BackoutCount : 0
ReplyToQ : ' '
ReplyToQMgr : 'QMGR '
** Identity Context
UserIdentifier : 'rivera '
AccountingToken :
X'16010515000000BA1E06D2603C3514885EDBC2EF03000000000000000000000B'
ApplIdentityData : ' '
** Origin Context
PutApplType : '26'
PutApplName : 'QMGR '
PutDate : '20111207' PutTime : '20215396'
ApplOriginData : ' '

GroupId : X'000000000000000000000000000000000000000000000000'
MsgSeqNumber : '1'
Offset : '0'
MsgFlags : '0'
OriginalLength : '-1'

**** Message ****

length - 4 bytes

00000000: 5445 5354 'TEST '

****
若是二個queue 不在同一個qmgr上, 就要利用以下指令來建立 pub/sub hierarchy tree.
alter qmgr parent(parent_qmgr_name)

Connecting a queue manager to a publish/subscribe hierarchy