什么是< OPENSHIFT_MYSQL_ENABLED> openshift v3中的环境变量? [英] What is <OPENSHIFT_MYSQL_ENABLED> environment variable in openshift v3?

查看:138
本文介绍了什么是< OPENSHIFT_MYSQL_ENABLED> openshift v3中的环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在如下所示的Openshift v3 Wildfly容器的 standalone.xml 的数据源上设置enabled = true。

How can I to set enabled = "true" on datasource of standalone.xml of Openshift v3 Wildfly container like below.

<datasource jndi-name="java:jboss/datasources/MySQLDS" enabled="true" use-java-context="true" pool-name="MySQLDS" use-ccm="true">

我将 OPENSHIFT_MYSQL_ENABLED 环境变量设置为

答案参考站点为以下URL:

The answer reference site is the below URL:

https://developer.jboss.org/wiki/DataserviceBuilderOnOpenShiftV3Online

推荐答案

我正在处理同一问题:环境变量 OPENSHIFT_MYSQL_ENABLED 是被变量替换过程所忽略,所以我不得不赤手激活数据源,这就是我所做的:
(我假设您的系统上已安装了OC工具)

I was dealing with the same problem: the environment variable OPENSHIFT_MYSQL_ENABLED is being ignored by variable substitution process, so I had to activate the data source with my bare hands, and that's what I did: (I'm going to assume you have the OC tools installed on your system)


  1. 登录OC: oc登录

  2. 列表所有pod并找到WildFly实例: oc get pods

  3. 进入容器的SSH控制台: oc rsh< ;< pod-name>>

  4. 编辑 standalone.xml 文件 vi /wildfly/standalone/configuration/standalone.xml

  5. 通过在vi编辑器上键入 / datasource 来搜索数据源一词,然后按Enter键

  6. 找到数据源的启用属性,并将其值从 false 更新为 true (为此,请按 i 进入vi插入模式)

  7. 通过按<$ c $保存文件c> esc 然后:x

  1. log into OC: oc login
  2. list all pods and find the WildFly instance: oc get pods
  3. enter the container's SSH console: oc rsh <<pod-name>>
  4. edit the standalone.xml file vi /wildfly/standalone/configuration/standalone.xml
  5. search for the word "datasource" by typing /datasource on vi editor then press enter
  6. find the attribute "enabled" of your data source and update its value from false to true (to do so, press i to go to vi insert mode)
  7. save the file by pressing esc then :x

I由于使用的是OpenShift社区版,因此重新启动容器总是很麻烦:查找可用资源(如内存和CPU)并重新启动服务器需要很长时间,但是,您不会启用数据源除非您重新启动服务器。因此,您无需重新启动容器,只需使用 jboss-cli.sh 命令行工具重新加载WildFly。 (我并没有试图终止该过程并重新开始,因此,如果您尝试过,请发表评论是否可行)。
以下步骤应在容器的终端上使用 oc rsh<< podname>> 或在Web控制台上执行。

I'm using OpenShift community edition, so to restart the container is always a hassle: it takes a very long time to find resources available (like memory and CPU) and start the server again, however, you won't have your data source enabled unless you restart the server. In this regard, to do so, you don't need to restart the container, just reload WildFly by using jboss-cli.sh command line tools. (I didn't try to kill the process and start it again, so if you did try, please comment if it worked). The following steps should be executed on container's terminal using oc rsh <<podname>> or using the terminal on web console.


  1. 使用命令 /wildfly/bin/jboss-cli.sh
  2. 键入 connect 登录WildFly控制台,系统将提示您输入用户名和密码。如果您没有凭据,请退出此控制台并通过执行脚本 /wildfly/bin/add-user.sh <来创建管理用户 / li>
  3. 通过键入 data-source read-resource --name =<<< YOUR_DATASOURCE_NAME>>来检查您的数据源属性。 --include-runtime = true --recursive = true 并跟踪 enabled属性。

  4. 如果您的数据源被禁用,则应通过输入命令 data-source enable --name =<< YOUR_DATASOURCE_NAME>>> code>

  5. 通过输入 reload 命令重新加载WildFly。一旦WildFly重新启动,您将需要访问jboss-cli.sh并再次登录控制台。

  6. 使用命令 data-source test测试数据源连接-connection-in-pool --name =<< YOUR_DATASOURCE_NAME>> 。如果命令输出为 true ,则您的数据源已启动并正在运行。

  1. Enter jboss-cli using the command /wildfly/bin/jboss-cli.sh
  2. Type connect to log into the WildFly console, you'll be prompted for user and password. If you do not have credentials, exit this console and create a management user by executing the script /wildfly/bin/add-user.sh
  3. Check your data source properties by typing data-source read-resource --name=<<YOUR_DATASOURCE_NAME>> --include-runtime=true --recursive=true and follow up on the "enabled" property.
  4. If your data source is disabled, you should enable it by entering the command data-source enable --name=<<YOUR_DATASOURCE_NAME>>
  5. reload WildFly by entering the reload command. Once WildFly reboots you'll need to access jboss-cli.sh and log into the console again.
  6. test your data source connection using the command data-source test-connection-in-pool --name=<<YOUR_DATASOURCE_NAME>>. If the command output was true your data source is up and running.

Openshift v3基于docker容器,因此,如果您重新启动容器,恐怕此配置可能会丢失。最合适的解决方案是将该操作包括在docker的脚本中,我尚不知道它如何与Openshift平台一起使用。

Openshift v3 is based on docker containers, therefore I'm afraid if you do restart the container, this configuration will probably be lost. The most appropriated solution would be to include this actions on docker's script, which I don't know yet how it works along with Openshift platform.

希望它会有所帮助!

Hope it helps!

这篇关于什么是&lt; OPENSHIFT_MYSQL_ENABLED&gt; openshift v3中的环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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