activemq-artemis/docs/user-manual/zh/libaio.xml

115 lines
6.3 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<!-- ============================================================================= -->
<!-- Copyright © 2009 Red Hat, Inc. and others. -->
<!-- -->
<!-- The text of and illustrations in this document are licensed by Red Hat under -->
<!-- a Creative Commons AttributionShare Alike 3.0 Unported license ("CC-BY-SA"). -->
<!-- -->
<!-- An explanation of CC-BY-SA is available at -->
<!-- -->
<!-- http://creativecommons.org/licenses/by-sa/3.0/. -->
<!-- -->
<!-- In accordance with CC-BY-SA, if you distribute this document or an adaptation -->
<!-- of it, you must provide the URL for the original version. -->
<!-- -->
<!-- Red Hat, as the licensor of this document, waives the right to enforce, -->
<!-- and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent -->
<!-- permitted by applicable law. -->
<!-- ============================================================================= -->
<chapter id="libaio">
<title>Libaio平台专有库</title>
<para>ActiveMQ发布包中包括一个平台专有的库它可以使ActiveMQ使用Linux操作系统的libaio。</para>
<para><literal>libaio</literal>是Linux项目的一个库。它将用户提交的写操作用异步的方式执行。通过
回调用户的代码来通知写操作的完成。</para>
<para>通过配置ActiveMQ可以使用这个库来访问高性能的日志具体请参见 <xref
linkend="persistence"/>。</para>
<para>下面列出了ActiveMQ所带的平台专有库文件</para>
<itemizedlist>
<listitem>
<para>libActiveMQAIO32.so - x86 32 位平台</para>
</listitem>
<listitem>
<para>libActiveMQAIO64.so - x86 64 位平台</para>
</listitem>
</itemizedlist>
<para>当使用libaio时ActiveMQ会在<link linkend="using-server.library.path">库路径</link>中寻找并装
载这些文件。</para>
<section>
<title>库文件的编译</title>
<para>如果你的Linux平台不是x86_32或x86_64比如Itanium 64或IBM Power你需要自己编译相应的库文件
因为ActiveMQ不提供这些平台的库文件。</para>
<section>
<title>安装要求</title>
<note>
<para>目前libaio只在Linux上有。所以它不可能在其它操作系统上编译。</para>
</note>
<para>编译需要<ulink url="http://en.wikipedia.org/wiki/Autoconf"
>autoconf</ulink>工具,它用来简化编译过程。除此之外还需要一些安装包:</para>
<itemizedlist>
<listitem>
<para>gcc - C 编译器</para>
</listitem>
<listitem>
<para>gcc-c++ or g++ - gcc的c++编译工具扩展</para>
</listitem>
<listitem>
<para>autoconf - 自动编译工具</para>
</listitem>
<listitem>
<para>make - make 工具</para>
</listitem>
<listitem>
<para>automake - make文件自动生成工具</para>
</listitem>
<listitem>
<para>libtool - 库连接工具</para>
</listitem>
<listitem>
<para>libaio - 磁盘异步IO库</para>
</listitem>
<listitem>
<para>libaio-dev - libaio的编译支持</para>
</listitem>
<listitem>
<para>完整的JDKJAVA_HOME要指向正确的位置</para>
</listitem>
</itemizedlist>
<para>如果在RHEL或Fedora上进行安装输入以下命令</para>
<programlisting>sudo yum install automake libtool autoconf gcc-g++ gcc libaio libaio-dev make</programlisting>
<para>如果是 debian系统</para>
<programlisting>sudo apt-get install automake libtool autoconf gcc-g++ gcc libaio libaio-dev make</programlisting>
<note>
<para>在有些Linux的版本中上述的安装包名可能有一些差别。例如Fedora中的gcc-c++在Debian系统中
的名称为g++</para>
</note>
</section>
<section>
<title>开始编译</title>
<para>在ActiveMQ发布包的<literal>native-src</literal>目录下执行shell脚本
<literal>bootstrap</literal>。这个脚本会调用 <literal
>automake</literal>以及<literal>make</literal>来创建所有的make文件和专有库。</para>
<programlisting>someUser@someBox:/messaging-distribution/native-src$ ./bootstrap
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating ./src/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
...</programlisting>
<para>编译好的库文件在<literal
>./native-src/src/.libs/libActiveMQAIO.so</literal>。将该文件移到发布包的
<literal>bin</literal>目录下,或者你的<link linkend="using-server.library.path">库目录</link>
所指向的目录即可。</para>
<para>如果你修改了ActiveMQ的libaio代码只需要在<literal>native-src</literal>目录下直挂运行make即可完成编译。</para>
</section>
</section>
</chapter>