wildfly命令行模式下配置数据源驱动的方式

echo "module add --name=com.mysql --resources=mysql-connector-java-5.1.40-bin.jar --dependencies=javax.api,javax.transaction.api" | /eduapp/keycloak/bin/jboss-cli.sh --connect --controller=10.32.1.128:9990 #这里的mysql-connector-java-5.1.40-bin.jar放置到wildfly的/bin目录下,--controller后边的地址10.32.1.128:9990是你绑定的管理地址,默认为localhost

echo "/subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-class-name=com.mysql.jdbc.Driver,driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource)"| /eduapp/keycloak/bin/jboss-cli.sh --connect --controller=10.32.1.128:9990



Running the CLI

Depending on the operating system, the CLI is launched usingjboss-cli.shorjboss-cli.batlocated in the WildFlybindirectory. For further information on the default directory structure, please consult the "Getting Started Guide".

The first thing to do after the CLI has started is to connect to a managed WildFly instance. This is done using the commandconnect, e.g.

./bin/jboss-cli.sh

You are disconnected at the moment. Type 'connect'to connect to the server

or 'help'forthe list of supported commands.

[disconnected /]


[disconnected /] connect

[domain@localhost:9990/]


[domain@localhost:9990/] quit

Closed connection to localhost:9990

localhost:9990is the default host and port combination for the WildFly CLI client.

The host and the port of the server can be provided as an optional parameter, if the server is not listening on localhost:9990.

./bin/jboss-cli.sh

You are disconnected at the moment. Type 'connect'to connect to the server

[disconnected /] connect 192.168.0.10:9990

Connected to standalone controller at 192.168.0.1:9990

The :9990 is not required as the CLI will use port 9990 by default.

The port needs to be provided if the server is listening on some other

port.

To terminate the session typequit.

The jboss-cli script accepts a --connect parameter: ./jboss-cli.sh --connect

The --controller parameter can be used to specify the host and portof the server: ./jboss-cli.sh --connect --controller=192.168.0.1:9990

你可能感兴趣的:(wildfly命令行模式下配置数据源驱动的方式)