Mulesoft 简明教程
MuleSoft - Mule in Our Machine
在前面章节中,我们了解了 Mule ESB 的基础知识。在本章节中,我们将了解如何安装和配置它。
In the previous chapters, we have learnt the basics of Mule ESB. In this chapter, let us learn how to install and configure it.
Prerequisites
在计算机上安装 Mule 之前,我们需要满足以下先决条件−
We need to satisfy the following prerequisites before installing Mule on our computer −
Java Development Kit (JDK)
在安装 MULE 之前,请验证您的系统上是否支持 Java 版本。建议使用 JDK 1.8.0 在您的系统上成功安装 Mule。
Before installing MULE, verify that you have supported version of Java on your system. JDK 1.8.0 is recommended to successfully install Mule on your system.
Operating System
Mule 支持以下操作系统−
Following operating systems are supported by Mule −
-
MacOS 10.11.x
-
HP-UX 11iV3
-
AIX 7.2
-
Windows 2016 Server
-
Windows 2012 R2 Server
-
Windows 10
-
Windows 8.1
-
Solaris 11.3
-
RHEL 7
-
Ubuntu Server 18.04
-
Linux Kernel 3.13+
Database
由于 Mule Runtime 以独立服务器的形式运行,因此不需要应用程序服务器或数据库。但是,如果我们需要访问数据存储或想要使用应用程序服务器,可以使用以下受支持的应用程序服务器或数据库−
An application server or database is not required as the Mule Runtime runs as a standalone server. But if we need to access a data store or want to use an application server, following supported application servers or databases can be used −
-
Oracle 11g
-
Oracle 12c
-
MySQL 5.5+
-
IBM DB2 10
-
PostgreSQL 9
-
Derby 10
-
Microsoft SQL Server 2014
System Requirements
在系统上安装 Mule 之前,它必须满足以下系统要求−
Before installing Mule on your system, it must fulfil the following system requirements −
-
At least 2 GHz CPU or 1 Virtual CPU in virtualized environments
-
Minimum 1 GB RAM
-
Minimum 4 GB storage
Download Mule
要下载 Mule 4 二进制文件,请点击链接 https://www.mulesoft.com/lp/dl/mule-esb-enterprise ,它会将您引导至 MuleSoft 的官方网页,如下所示−
To download Mule 4 binary file, click on the link https://www.mulesoft.com/lp/dl/mule-esb-enterprise and it will lead you to the official web page of MuleSoft as follows −
通过提供必要的信息,您会以 Zip 格式获取 Mule 4 二进制文件。
By providing the necessary details, you can get the Mule 4 binary file in Zip format.
Install and Run Mule
现在在下载完 Mule 4 二进制文件后,解压缩它并设置一个名为 MULE_HOME 的环境变量,用于提取的文件夹中的 Mule 目录。
Now after downloading the Mule 4 binary file, unzip it and set an environment variable called MULE_HOME for the Mule directory inside the extracted folder.
例如,Windows 和 Linux/Unix 环境中的环境变量,可以在 Downloads 目录中设置为版本 4.1.5,如下所示−
For example, the environment variable, on Windows and Linux/Unix environments, can be set for version 4.1.5 in the Downloads directory as follows −
Unix/Linux Environments
$ export MULE_HOME=~/Downloads/mule-enterprise-standalone-4.1.5/
现在,要测试 Mule 是否在您的系统中无任何错误地运行,请使用以下命令−
Now, for testing whether Mule is running in your system without any error, use the following commands −
Unix/Linux Environments
$ $MULE_HOME/bin/mule
以上命令将在前台模式下运行 Mule。如果 Mule 正在运行,我们无法在终端上发布任何其他命令。在终端中按 ctrl-c 命令将停止 Mule。
The above commands will run Mule in the foreground mode. If Mule is running, we cannot issue any other commands on the terminal. Pressing ctrl-c command in the terminal, will stop Mule.
Start Mule Services
我们还可以将 Mule 作为 Windows 服务和 Linux/Unix 后台程序启动。
We can start Mule as a Windows Service and as a Linux/Unix Daemon also.
Mule as a Windows Service
若要作为 Windows 服务运行 Mule,我们需要按照如下步骤 −
To run Mule as a Windows service, we need to follow the below steps −
Step 1 - 首先,借助以下命令安装它 −
Step 1 − First, install it with the help of following command −
$ $MULE_HOME\bin\mule.bat install
Step 2 - 安装完成后,借助以下命令,我们可以将 mule 作为 Windows 服务运行:
Step 2 − Once installed, we can run mule as a Windows service with the help of the following command:
$ $MULE_HOME\bin\mule.bat start
Mule as a Linux/Unix Daemon
若要将 Mule 作为 Linux/Unix 守护进程运行,我们需要按照以下步骤操作:
To run Mule as a Linux/Unix Daemon, we need to follow the below steps −
Step 1 - 在安装它的帮助下使用以下命令进行安装:
Step 1 − Install it with the help of the following command −
$ $MULE_HOME/bin/mule install
Step 2 - 安装后,我们可以在以下命令的帮助下将 mule 作为 Windows 服务运行:
Step 2 − Once installed, we can run mule as a Windows service with the help of following command −
$ $MULE_HOME/bin/mule start
Example
以下示例将 Mule 作为 Unix 守护进程启动:
The following example starts Mule as a Unix Daemon −
$ $MULE_HOME/bin/mule start
MULE_HOME is set to ~/Downloads/mule-enterprise-standalone-4.1.5
MULE_BASE is set to ~/Downloads/mule-enterprise-standalone-4.1.5
Starting Mule Enterprise Edition...
Waiting for Mule Enterprise Edition.................
running: PID:87329
Deploy Mule Apps
我们可以借助以下步骤部署我们的 Mule 应用程序:
We can deploy our Mule apps with the help of following steps −
Step 1 - 首先,启动 Mule。
Step 1 − First, start Mule.
Step 2 - Mule 启动后,我们可以通过将 JAR 包文件移到 apps 中的 $MULE_HOME 目录来部署我们的 Mule 应用程序。
Step 2 − Once Mule starts, we can deploy our Mule applications by moving our JAR package files to the apps directory in $MULE_HOME.
Stop Mule Services
我们可以使用 stop 命令来停止 Mule。例如,以下示例将 Mule 作为 Unix 守护进程启动:
We can use stop command to stop Mule. For example, the following example starts Mule as a Unix Daemon −
$ $MULE_HOME/bin/mule stop
MULE_HOME is set to /Applications/mule-enterprise-standalone-4.1.5
MULE_BASE is set to /Applications/mule-enterprise-standalone-4.1.5
Stopping Mule Enterprise Edition...
Stopped Mule Enterprise Edition.
我们还可以使用 remove 命令从我们的系统中删除 Mule 服务或守护进程。以下示例将 Mule 作为 Unix 守护进程删除:
We can also use remove command to remove the Mule Service or Daemon from our system. The following example removes Mule as a Unix Daemon −
$ $MULE_HOME/bin/mule remove
MULE_HOME is set to /Applications/mule-enterprise-standalone-4.1.5
MULE_BASE is set to /Applications/mule-enterprise-standalone-4.1.5
Detected Mac OSX:
Mule Enterprise Edition is not running.
Removing Mule Enterprise Edition daemon...