You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/03/09 12:17:42 UTC

[incubator-servicecomb-saga] 03/03: SCB-330 add guides to run executable alpha server with mysql

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git

commit e5dd6df0e19cc200df30e1bfddb2fff5c47ec4b5
Author: Eric Lee <da...@huawei.com>
AuthorDate: Fri Mar 9 11:49:01 2018 +0800

    SCB-330 add guides to run executable alpha server with mysql
    
    Signed-off-by: Eric Lee <da...@huawei.com>
---
 .../how_to_use_mysql_as_alpha_backend_database.md  | 24 +++++++++++++++++++-
 .../how_to_use_mysql_as_alpha_backend_database.md  | 26 ++++++++++++++++++++--
 docs/user_guide.md                                 |  4 ++--
 docs/user_guide_zh.md                              |  4 ++--
 4 files changed, 51 insertions(+), 7 deletions(-)

diff --git a/docs/faq/cn/how_to_use_mysql_as_alpha_backend_database.md b/docs/faq/cn/how_to_use_mysql_as_alpha_backend_database.md
index 891a124..f241b36 100644
--- a/docs/faq/cn/how_to_use_mysql_as_alpha_backend_database.md
+++ b/docs/faq/cn/how_to_use_mysql_as_alpha_backend_database.md
@@ -8,5 +8,27 @@
          <artifactId>mysql-connector-java</artifactId>
        </dependency>
    ```
+
+2. 安装Saga
+   ```bash
+   mvn clean install -Pdocker -DskipTests
+   ```
+   在命令执行完成后,会生成名为alpha-server的镜像和可执行文件`alpha/alpha-server/target/saga/alpha-server-${version}-exec.jar`。
+   **注意**: 如果不需要生成docker镜像,则直接运行`mvn clean install -DskipTests`即可。
+   **注意**: 如果您之前已生成了alpha-server的docker镜像,则需要在运行命令前将其删除。
    
-2. 在alpha启动时通过添加`-Dspring.profiles.active=mysql`的启动参数来使mysql的配置生效。
+3. 运行MySQL
+   ```bash
+   docker run -d -e "MYSQL_ROOT_PASSWORD=password" "-e "MYSQL_DATABASE=saga" -e "MYSQL_USER=saga" -e "MYSQL_PASSWORD=password" -p 3306:3306 mysql/mysql-server:5.7
+   ```
+
+4. 运行alpha。请确保MySQL在此前已成功启动。alpha的运行可通过docker或可执行文件的方式。
+   * 通过docker
+      ```bash
+      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=mysql -Dspring.datasource.url=jdbc:mysql://${host_address}:3306/saga?useSSL=false" alpha-server:${saga_version}
+      ```
+   * 通过可执行文件
+      ```bash
+      java -Dspring.profiles.active=mysql -D"spring.datasource.url=jdbc:mysql://${host_address}:3306/saga?useSSL=false" -jar alpha-server-${saga_version}-exec.jar
+      ```
+   **注意**: 请在运行命令前将`${saga_version}`和`${host_address}`更改为实际值。
diff --git a/docs/faq/en/how_to_use_mysql_as_alpha_backend_database.md b/docs/faq/en/how_to_use_mysql_as_alpha_backend_database.md
index adb44e2..2bb2954 100644
--- a/docs/faq/en/how_to_use_mysql_as_alpha_backend_database.md
+++ b/docs/faq/en/how_to_use_mysql_as_alpha_backend_database.md
@@ -8,5 +8,27 @@
          <artifactId>mysql-connector-java</artifactId>
        </dependency>
    ```
-   
-2. activate mysql profile by specifying option `-Dspring.profiles.active=mysql` when booting alpha.
\ No newline at end of file
+
+2. install Saga
+   ```bash
+   mvn clean install -Pdocker -DskipTests
+   ```
+   After that, you will find the generated docker image `alpha-server` and executable file `alpha/alpha-server/target/saga/alpha-server-${version}-exec.jar`.
+   **Notice**: If you do not want to build the docker image, run `mvn clean install -DskipTests` is enough.
+   **Notice**: If you have installed saga with docker before, you need to remove the alpha-server's docker image first.
+
+3. run MySQL
+   ```bash
+   docker run -d -e "MYSQL_ROOT_PASSWORD=password" "-e "MYSQL_DATABASE=saga" -e "MYSQL_USER=saga" -e "MYSQL_PASSWORD=password" -p 3306:3306 mysql/mysql-server:5.7
+   ```
+
+4. Run alpha. Please make sure MySQL is up before this step. You can run alpha through docker or executable file.
+   * via docker
+      ```bash
+      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=mysql -Dspring.datasource.url=jdbc:mysql://${host_address}:3306/saga?useSSL=false" alpha-server:${saga_version}
+      ```
+   * via executable file
+      ```bash
+      java -Dspring.profiles.active=mysql -D"spring.datasource.url=jdbc:mysql://${host_address}:3306/saga?useSSL=false" -jar alpha-server-${saga_version}-exec.jar
+      ```
+   **Notice**: Please change `${saga_version}` and `${host_address}` to the actual value before you execute the command.
\ No newline at end of file
diff --git a/docs/user_guide.md b/docs/user_guide.md
index 97494ad..62eadc7 100644
--- a/docs/user_guide.md
+++ b/docs/user_guide.md
@@ -84,13 +84,13 @@ Take a transfer money application as an example:
 2. run alpha. Before running alpha, please make sure postgreSQL is already up. You can run alpha through docker or executable file.
    * Run alpha through docker.
       ```bash
-      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=prd -Dspring.datasource.url=jdbc:postgresql://${docker_host_address}:5432/saga?useSSL=false" alpha-server:${saga_version}
+      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=prd -Dspring.datasource.url=jdbc:postgresql://${host_address}:5432/saga?useSSL=false" alpha-server:${saga_version}
       ```
    * Run alpha through executable file.
       ```bash
       java -Dspring.profiles.active=prd -D"spring.datasource.url=jdbc:postgresql://${host_address}:5432/saga?useSSL=false" -jar alpha-server-${saga_version}-exec.jar
       ```
-   **Note**: Please change `${saga_version}` and `${docker_host_address}`/`${host_address}` to the actual value before you execute the command.
+   **Note**: Please change `${saga_version}` and `${host_address}` to the actual value before you execute the command.
 
 3. setup omega. Configure the following values in `application.yaml`.
    ```yaml
diff --git a/docs/user_guide_zh.md b/docs/user_guide_zh.md
index ac657f3..befc97c 100644
--- a/docs/user_guide_zh.md
+++ b/docs/user_guide_zh.md
@@ -83,13 +83,13 @@ $ mvn clean install -DskipTests -Pdocker
 2. 运行alpha。在运行alpha前,请确保postgreSQL已正常启动。可通过docker或可执行文件的方式来启动alpha。
    * 通过docker运行:
       ```bash
-      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=prd -Dspring.datasource.url=jdbc:postgresql://${docker_host_address}:5432/saga?useSSL=false" alpha-server:${saga_version}
+      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=prd -Dspring.datasource.url=jdbc:postgresql://${host_address}:5432/saga?useSSL=false" alpha-server:${saga_version}
       ```
    * 通过可执行文件运行:
       ```bash
       java -Dspring.profiles.active=prd -D"spring.datasource.url=jdbc:postgresql://${host_address}:5432/saga?useSSL=false" -jar alpha-server-${saga_version}-exec.jar
       ```
-   **注意**: 请在执行命令前将`${saga_version}`和`${docker_host_address}`/`${host_address}`更改为实际值。
+   **注意**: 请在执行命令前将`${saga_version}`和`${host_address}`更改为实际值。
 
 3. 配置omega。在 `application.yaml` 添加下面的配置项:
    ```yaml

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.