Submitted by gouki on 2014, June 5, 5:02 PM
先申明。。。参考本文,我并没有成功的搭建成功。因为我在执行第一个rpm --nodeps -ivh Runtime的时候。不是按照预想的安装在了/opt/mqm下面,而是提示我安装在/ filesystem下。所以我就没有办法下一步。因为在执行第二个安装的时候,它提示我没有在/opt/mqm下找到runtime。。。
不过我还是做个记录,因为我是debian系统。也许ubuntu下就会成功呢??原文来自:http://qtlkw.iteye.com/blog/744052
我转贴的并不全。下面的一些介绍我没有转,如果有兴趣可以移步原文,以下是转贴:
可参照文档http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=/com.ibm.mq.amq1ac.doc/lq10120_.htm 和http://blog.csdn.net/lang_ysh/archive/2010/03/18/5391971.aspx
1. Download WebSphere MQ7 tar.gz
2. run tar -zxvf CZ4VDML.tar.gz
3(optional). 创建WebSphere MQ 必需的文件系统,命令如下:
# for product code
mkdir /opt/mqm
# for working data
mkdir /var/mqm
网上看到说MQ安装时候默认的目录就是这两个
4. 创造MQ用户和用户组,命令如下:
groupadd mqm
useradd -d /var/mqm -g mqm -G mqm mqm
# change password to "password"
passwd mqm
5. 为mqm用户组添加root组
cd /etc
vi group
找到mqm:x:1003:mqm增加",root",修改成: mqm:x:1003:mqm,root
6(optional). 调整系统参数(视需要而定,我安装时并没修改)
make following kernel changes (/etc/sysctl.conf ):
kernel.msgmni = 1024
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 500 256000 250 1024
fs.file-max = 32768
net.ipv4.tcp_keepalive_time = 300
To load these sysctl values immediately, enter the command sysctl -p.
If you do not issue the sysctl -p command, the new values are loaded when the system is rebooted.
7. 安装rpm
sudo apt-get install rpm
8. 转到WebSphere MQ解压后的目录中,获得WebSphere MQ授权,命令如下:
./mqlicense.sh -text_only
阅读全文后,选择1接受授权。
9. 安装WebSphere MQ客户端和服务端,命令如下:
rpm --nodeps -ivh MQSeriesRuntime-7.0.1-0.i386.rpm
rpm --nodeps -ivh MQSeriesSDK-7.0.1-0.i386.rpm
rpm --nodeps -ivh MQSeriesJava-7.0.1-0.i386.rpm
rpm --nodeps -ivh MQSeriesClient-7.0.1-0.i386.rpm
rpm --nodeps -ivh MQSeriesSamples-7.0.1-0.i386.rpm
rpm -nodeps -ivh MQSeriesServer-7.0.1-0.i386.rpm(如果只装客户端,这个没必要安装)
原因: 不加-nodeps会报:
root@localhost:/apps# rpm -ivh MQSeriesRuntime-7.0.1-0.i386.rpm
error: Failed dependencies:
/bin/sh is needed by MQSeriesRuntime-7.0.1-0.i386
10. 安装校验
rpm -qa | grep MQSeries
MQSeriesSDK-7.0.1-0
MQSeriesClient-7.0.1-0
MQSeriesServer-7.0.1-0
MQSeriesRuntime-7.0.1-0
MQSeriesJava-7.0.1-0
MQSeriesSamples-7.0.1-0
安装MQ Explorer还需要安装其它的包:
MQSeriesConfig-7.0.1-0.i386.rpm
MQSeriesEclipseSDK33-7.0.1-0.i386.rpm
MQSeriesJRE-7.0.1-0.i386.rpm
至此MQ安装完成。
--END--
Tags: websphere
Linux | 评论:0
| 阅读:17676
Submitted by gouki on 2014, June 5, 4:58 PM
我在上一篇博客在centos下处理PHP+WebSphere客户端中提到了一个英文网站:http://blog.phpdeveloper.org/?p=140,我也是参考它才完成了最终的配置,为此我也写了中文的说明,但感觉文笔不行,所以我还是贴上原文吧:
During a recent project at work I had to get PHP linked with IBM’s WebSPhere MQ software we have running on another internal server. Our goal was to use our existing web service to take the requests from external vendors and push their XML data back into the queue inside our firewall. Thankfully there’s an extension in PECL that does just that.
Here’s the basic steps I took – hopefully it’ll be useful to someone else out there in the same spot I was. This all assumes you’re working on a web server that doesn’t have an MQ server installed already:
- Get the extension: Head over to the PECL page for mqseries and download the latest version. Unpack it into a directory on your local server
- Get the MQ client libs: You’ll need to go to IBM’s website to download the latest client/libraries for your install (you’ll need an IBM ID to get to the downloads):
- Go to the IBM page for the MQ client listing
- Look for the “WebSphere MQ Clients” link under the “Related products and technologies” section and click on it
- Scroll down to the “Download Package” section and choose from one of the mirror locations
- Select your package from the list (I went with “Linux for System x86″ for our setup)
- Click on the download link and fill out some required information (you didn’t think you were getting off that easy, did you?)
- Agree to the terms and conditions and you’ll get a “Download Now” link
- Drop the archive file (tar, tar.gz, etc) into your server and unpack into a temporary directory (mine had an issue unpacking into the local directory, not a subdirectory)
- Install the package(s): Once you have the IBM software extracted, you should have a series of packages. You’ll need to install the “MQSeriesSDK” to get the right libraries in place to compile the PHP extension
- Build the mqseries extension: Go into the mqseries directory and run “phpize”, “./configure” and “make” to create the .so file. The process should drop it into the default extensions directory.
- If needed, move it: Be sure that the shared module for the extension is in the right directory for the PHP install to find it. (You can make a phpinfo() page if you’re not sure where that is.)
- Update your php.ini: Add in a line to include the extension in your current setup. Remember, after any changes to the php.ini, you need to restart the web server.
Now for the fun part – if everything’s working and the extension shows up in your phpinfo() as active, give this script a shot and see if you can connect to your MQ server:
1 |
$mq_host_ip = '127.0.0.1' ; |
2 |
$queue_name = 'HOST.REMOTE.Q' ; |
3 |
$mq_server = 'WBRK_QM_U49' ; |
5 |
'Version' => MQSERIES_MQCNO_VERSION_2, |
6 |
'Options' => MQSERIES_MQCNO_STANDARD_BINDING, |
8 |
'ChannelName' => 'CLIENT.CHANNEL' , |
9 |
'ConnectionName' => $mq_host_ip , |
10 |
'TransportType' => MQSERIES_MQXPT_TCP |
15 |
mqseries_connx( $mq_server , $mqcno , $conn , $comp_code , $reason ); |
16 |
if ( $comp_code !== MQSERIES_MQCC_OK) { |
17 |
trigger_error( 'Cannot open connection to server: ' . $mq_server ,E_USER_ERROR); |
19 |
echo 'Connection good!' ; |
Obviously you’ll need to adjust the settings to fit your server, but at least this gives you a start.
--END
PHP | 评论:0
| 阅读:19964
Submitted by gouki on 2014, June 5, 4:55 PM
事先申明。我是借鉴了这篇博客:http://blog.phpdeveloper.org/?p=140
当然在其中遇到了不少问题,我在这里一一说明:
1、准备工作
a. pecl mqseries :http://pecl.php.net/package/mqseries
b. ibm mq client: http://www-01.ibm.com/software/integration/wmq/clients/
2、步骤:
1、先安装ibm mq client :下载地址最终是要翻墙的,我这里不教翻墙技术。下载完后,解开压缩,在centos下面,直接rpm -ivh
MQSeriesRuntime-7.5.0-3.x86_64.rpm,和rpm -ivh MQSeriesSDK-7.5.0-3.x86_64.rpm ,由于我们只是当成一个client库来连接,因此安装这两个就够了
2、编译mqseries。在这里我吃药了,我下载的是0.14版的,我一看更新时间是2014年。我想这是最新的总没问题吧。结果。。。./configure到最后的时候,说--with-libdir=lib64找不到,让我指定。可是我明明指定了也不能安装。于是google了一下,发现这曾经是一个BUG。在2012年解决掉了。在bug.php.net里。写的是bug fixed。所以我下载了0.13的,然后再安装,果然成功了
3、测试
PHP代码
- <?php
- $mq_host_ip ='127.0.0.1';
- $queue_name = 'HOST.REMOTE.Q';
- $mq_server = 'WBRK_QM_U49';
- $mqcno = array(
- 'Version' => MQSERIES_MQCNO_VERSION_2,
- 'Options' => MQSERIES_MQCNO_STANDARD_BINDING,
- 'MQCD' => array(
- 'ChannelName' => 'CLIENT.CHANNEL',
- 'ConnectionName' => $mq_host_ip,
- 'TransportType' => MQSERIES_MQXPT_TCP
- )
- );
-
-
- mqseries_connx($mq_server,$mqcno,$conn,$comp_code,$reason);
- if ($comp_code !== MQSERIES_MQCC_OK) {
- trigger_error('Cannot open connection to server: '.$mq_server,E_USER_ERROR);
- }else{
- echo 'Connection good!';
- }
$mq_server从手册上看得知这应该是:queue_manager,所以应该是manager的名称
如果你访问的mq不是默认的端口号,还要加上端口号。我在这里走了不少弯路。我原来connectionName是写成:127.0.0.1:1234,报错2387,意思是host not avarible。查了下资料,原来端口号应该是 ip(port),也就是说得:127.0.0.1(1234) 这样的形式才OK。于是改好后再测试就通过啦。
----
我是在一台干净的Centos上安装的。所以做了很多准备工作:
1、 yum install php php-devel(devel里面才有phpize)
2、yum install gcc gcc-c++ g++
然后在安装的时候还有提示:you will need re2c ...于是找到这个博客:http://denghai260.blog.163.com/blog/static/726864092012260242533/
里面说道:
XML/HTML代码
- wget http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/download
- tar -zxvf re2c-0.13.5.tar.gz
- cd re2c-0.13.5
- ./configure && make && make install
至此,遇到的所有的问题都解决了。
PHP | 评论:0
| 阅读:17106
Submitted by gouki on 2014, May 29, 4:16 PM
众所周知,微信里的网页就是一个webview。但是它是在程序里面,所以原生的window.close()是无效的。那么我们该怎么办?其实很简单就一句代码:
XML/HTML代码
- WeixinJSBridge.call('closeWindow');
你可以在你的链接或者button上加一句就OK了:
XML/HTML代码
- <a href="###" onclick="WeixinJSBridge.call('closeWindow');">CLOSE </a>
-
- 或者
-
- <a href="javascript:WeixinJSBridge.call('closeWindow');">CLOSE</a>
试试看。窗口是不是关掉了?
Tags: 微信
PHP | 评论:2
| 阅读:30726
Submitted by gouki on 2014, May 19, 11:11 PM
google的leveldb越来越被很多人接受。国内的ideawu基于leveldb还写了一个ssdb的前置扩展用来实现了很多功能,比如标准的getset和hget,hset还有zset,zget,也实现了队列。当然pub/sub就没有办法实现了。毕竟它和redis还是有点区别。
基于标准的ssdb的类,写了个小扩展,扩展了Yii的Cache类:
PHP代码
- class CSsdbCache extends CCache
- {
-
-
-
- public $hostname = '127.0.0.1';
-
-
-
- public $port = 8888;
-
-
-
- public $timeout = 2000;
- public $serializer = false;
- public $_cache;
- protected $_cachekeys = 'ssdb_cachekey';
-
- public function init() {
- parent::init();
- }
-
-
-
- public function getSsdbCache() {
- if ($this->_cache !== null)
- return $this->_cache;
- else {
- return $this->_cache = new SimpleSSDB($this->hostname, $this->port, $this->timeout);
- }
- }
- public function getkeys() {
- return $this->getSsdbCache()->hkeys($this->_cachekeys, "", "", $this->getSsdbCache()->hsize($this->_cachekeys));
- }
-
-
-
-
-
-
- protected function getValue($key) {
- return unserialize($this->getSsdbCache()->get($key));
- }
-
-
-
-
-
-
-
-
-
- protected function setValue($key, $value, $expire) {
- $this->getSsdbCache()->hset($this->_cachekeys, $key, 1);
- if ($expire > 0) {
-
- return $this->getSsdbCache()->setx($key, serialize($value), (int) $expire);
- }
- else {
- return $this->getSsdbCache()->set($key, serialize($value));
- }
- }
-
-
-
-
-
-
-
-
- protected function addValue($key, $value, $expire) {
- return $this->setValue($key, $value, $expire);
- }
-
-
-
-
-
-
- protected function deleteValue($key) {
- $this->getSsdbCache()->hdel($this->_cachekeys, $key);
- return $this->getSsdbCache()->del($key);
- }
-
-
-
- protected function flushValues() {
- $this->getSsdbCache()->multi_del($this->getkeys());
- return $this->getSsdbCache()->hclear($this->_cachekeys);
- }
- }
其实代码很简单,不过由于ssdb默认没有serialize功能,所以在存储之前,得先主动的serialize,然后get的时候unserialize。不然就没有办法存储数组了。
由于ssdb没有flush功能。所以利用hget/hset将所有的key存储下来。flush的时候把hget获取的key读出来删除。然后再清掉这个hget的key
最后还有expire。ssdb里的setx第三个参数。。。居然不是expire,而是ttl。开始的时候,一直都当成expire。结果浪费了很长时间
Tags: yii
PHP Framework | 评论:1
| 阅读:21145