导出的正确方法是将WildFly 9服务器选项转移到其他PC [英] Right way to export\transfer WildFly 9 server options to other PC

查看:143
本文介绍了导出的正确方法是将WildFly 9服务器选项转移到其他PC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将\transfer选项(例如DataSource到MySQL)导出到其他PC\server。如何正确地做到这一点?

I need to export\transfer options (such as DataSource to MySQL) to other PC\server. How to do it correctly?

我曾尝试复制并重命名standalone.xml并通过以下命令在其他PC上运行:

I had tried to copy and rename standalone.xml and run it on other PC by following command:

./standalone.sh --server-config=standalone-(full)-myProject.xml

这是正确的方法吗?

下一个问题 - 如何正确导出安装模块(在WildFly中)的MySQL?
我在我的机器上安装了这个(作为模块) http://hpehl.info /jdbc-driver-setup.html

And next problem - how export installed module (in WildFly) for MySQL correctly? I installed it like this (as module) at my machine http://hpehl.info/jdbc-driver-setup.html

推荐答案

我强烈建议您使用jboss-cli来运行相反。复制文件会有效,但我认为最好有一个可重复的过程。

I would strongly encourage you to use the jboss-cli to run this instead. Copying the files will work but I would argue that it's better to have a repeatable process.

要添加数据源,您需要运行以下命令。由于您使用的是WildFly 9,因此它可以更简单一些。将以下命令放在文件中 - 例如,db_setup.txt。然后运行 $ WILDFLY_HOME / bin / jboss-cli.sh --file = db_setup.txt 。该文件将包含以下内容:

To add a datasource, you'd run the following. Since you're using WildFly 9, it can be a bit simpler. Put the following commands in a file - for example, db_setup.txt. Then run $WILDFLY_HOME/bin/jboss-cli.sh --file=db_setup.txt. The file will contain something like the following:

embed-server --std-out=echo --server-config=standalone.xml

batch

module add --name=com.mysql.driver --resources=/path/to/mysql-connector-java-5.1.33.jar --dependencies=javax.api,javax.transaction.api
/subsystem=datasources/jdbc-driver=mysql:add(driver-name="mysql",driver-module-name="com.mysql.driver",driver-class-name=com.mysql.jdbc.Driver)
/subsystem=datasources/data-source=myPool/:add(connection-url=jdbc:mysql://127.0.0.1:3306/dbName,driver-name=mysql,jndi-name=java:/jdbc/dbName,password=password,user-name=user)

警告 - 我尚未对这些命令进行全面测试,因此可能需要进行一些调整。但是概念就在那里。

WARNING - I have not fully tested these commands so they may require a bit of tweaking. But the concepts are there.

您将遇到的一个问题是,在测试期间,如果出现错误,jboss-cli.sh命令将退出。您可能还需要一个文件来删除它们:

The one issue you'll have is that, during testing, the jboss-cli.sh command will just exit if there is an error. You may want a file to remove these too:

/subsystem=datasources/data-source=myPool/:remove
/subsystem=datasources/jdbc-driver=my:remove
module remove --name=com.mysql.driver

这篇关于导出的正确方法是将WildFly 9服务器选项转移到其他PC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆