在Weblogic 12c docker中创建新的托管服务器容器

时间:2021-01-14 21:34:20

I followed the Oracle docs and managed to set up a running Weblogic Fusion Middleware Infrastructure Container with one Managed server..

我遵循Oracle文档并设法使用一个托管服务器建立一个正在运行的Weblogic Fusion Middleware Infrastructure Container。

I deployed an ADF application and it works perfectly fine ..

我部署了一个ADF应用程序,它工作得很好..

But now I am stuck because I cant add more Managed servers in the cluster.

但现在我被卡住了,因为我无法在群集中添加更多托管服务器。

The following command was used to start the managedserver1 which works perfectly..

以下命令用于启动完美运行的managedserver1。

docker run -d -p 9801:8001 --network=InfraNET --volumes-from InfraAdminContainer --name InfraManagedContainer --env-file ./infraServer.env.list container-registry.oracle.com/middleware/fmw-infrastructure:12.2.1.x startManagedServer.sh

here is the startManagedServer.sh script :

这是startManagedServer.sh脚本:

#!/bin/bash

# Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
#
#Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
#

export adminhostname=$adminhostname
export adminport=$adminport


# First Update the server in the domain
export server="infra_server1"
export DOMAIN_ROOT="/u01/oracle/user_projects/domains"
export DOMAIN_HOME="/u01/oracle/user_projects/domains/InfraDomain"

echo $adminhostname
echo $adminport
echo "DOMAIN_HOME: $DOMAIN_HOME"

/u01/oracle/oracle_common/common/bin/wlst.sh -skipWLSModuleScanning /u01/oracle/container-scripts/update_listenaddress.py $server
retval=$?

echo  "RetVal from Update listener call  $retval"

if [ $retval -ne 0 ];
then
    echo "Update listener Failed.. Please check the  Logs"
    exit
fi

# Start Infra server
mkdir -p /u01/oracle/logs
$DOMAIN_HOME/bin/startManagedWebLogic.sh $server "http://"$adminhostname:$adminport > /u01/oracle/logs/startManagedWebLogic$$.log 2>&1 &
statusfile=/tmp/notifyfifo.$$

mkfifo "${statusfile}" || exit 1
{
    # run tail in the background so that the shell can kill tail when notified that grep has exited
    tail -f /u01/oracle/logs/startManagedWebLogic$$.log &
    # remember tail's PID
    tailpid=$!
    # wait for notification that grep has exited
    read templine <${statusfile}
                        echo ${templine}
    # grep has exited, time to go
    kill "${tailpid}"
} | {
    grep -m 1 "<Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.>"
    # notify the first pipeline stage that grep is done
        echo "RUNNING"> /u01/oracle/logs/startManagedWebLogic$$.status
        echo "Infra server is running"
    echo >${statusfile}
}

# clean up
rm "${statusfile}"
if [ -f /u01/oracle/logs/startManagedWebLogic$$.status ]; then
echo "Infra server has been started"
fi

#Display the logs
tail -f $DOMAIN_HOME/servers/infra_server1/logs/infra_server1.log

childPID=$!
wait $childPID

I did manage to add the Managed-Servers in the weblogic admin console by editing createorstartInfraDomain.sh and createInfraDomain.py

我确实设法通过编辑createorstartInfraDomain.sh和createInfraDomain.py在weblogic管理控制台中添加Managed-Servers。

However editing the StartManagedServer.sh file for Infra_Server2 is not working..

但是,编辑Infra_Server2的StartManagedServer.sh文件不起作用..

Even after editing or even completely deleting the file startManagedServer.sh from the admin container the following command still works:

即使在从admin容器编辑甚至完全删除文件startManagedServer.sh之后,以下命令仍然有效:

docker run -d -p 9801:8001 --network=InfraNET --volumes-from InfraAdminContainer --name InfraManagedContainer --env-file ./infraServer.env.list container-registry.oracle.com/middleware/fmw-infrastructure:12.2.1.x startManagedServer.sh

The following is what i get in the console :

以下是我在控制台中获得的内容:

root@Linux-Vostro-3250:/home/amalv/FMW-Infrastructure_Docker# docker run -p 9801:8001 --network=InfraNET --volumes-from InfraAdminContainer --name InfraManagedContainer --env-file ./infraserver.env.list oracle/fmw-infrastructure:12.2.1.0 startManagedServer.shInfraAdminContainer
7001
DOMAIN_HOME: /u01/oracle/user_projects/domains/InfraDomain

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

/u01/oracle/container-scripts/update_listenaddress.py called with the following sys.argv array:
sys.argv[0] = /u01/oracle/container-scripts/update_listenaddress.py
sys.argv[1] = infra_server1
c697c81b15c8
172.18.0.4
/u01/oracle/user_projects/domains/InfraDomain
INFO: SeedingConfigurationProcessor.start, finished.
INFO: SeedingConfigurationProcessor.end, finished.

whatever i do with the startManagedServer.sh I get the above log with "sys.argv[1] = infra_server1".

无论我使用startManagedServer.sh做什么,我都使用“sys.argv [1] = infra_server1”获取上述日志。

Can someone help me with this!!

有人可以帮我弄这个吗!!

Thanks a lot

非常感谢

1 个解决方案

#1


0  

Here is what i did that helped me to set up Multiple managed servers .

以下是我所做的,它帮助我设置了多个托管服务器。

  • Initially i ran the following command which is from the instructions in container-registry.oracle.com:

    最初我运行了以下命令,该命令来自container-registry.oracle.com中的说明:

    docker run -d -p 9001:7001 --network=InfraNET -v $HOST_VOLUME:/u01/oracle/user_projects --name InfraAdminContainer --env-file ./infraDomain.env.list container-registry.oracle.com/middleware/fmw-infrastructure:12.2.1.2
    
  • Then I copied my edited Container-scripts into the Container-scripts in the Admin container.

    然后我将编辑好的Container-scripts复制到Admin容器中的Container-scripts中。

  • Deleted the already created domain directory from the container.

    从容器中删除已创建的域目录。

  • committed the container to a new image.

    将容器提交到新图像。

alternatively you can mount the edited files into container in docker run command.

或者,您可以在docker run命令中将已编辑的文件装入容器中。

I edited the createInfraDomain.py and createOrStartInfradomain.sh files in the container-scripts to create 6 infra-servers.This will create 6 infraserver instances and you will be able to see it in the weblogic console.

我在容器脚本中编辑了createInfraDomain.py和createOrStartInfradomain.sh文件以创建6个infra-servers。这将创建6个infraserver实例,您将能够在weblogic控制台中看到它。

Now use the following command to start the first Managed Server container:

现在使用以下命令启动第一个受管服务器容器:

docker run -d -p 9802:8001 --network=InfraNET --volumes-from InfraAdminContainer --name InfraManagedContainer --env-file ./infraserver.env.list previously-committed-image startManagedServer.sh

docker run -d -p 9802:8001 --network = InfraNET --volumes-来自InfraAdminContainer --name InfraManagedContainer --env-file ./infraserver.env.list previous-committed-image startManagedServer.sh

For startning a new managed server container I edited the startManagedServer.sh file and changed the server value to infra_server2 and ran the following command:

为了启动新的托管服务器容器,我编辑了startManagedServer.sh文件并将服务器值更改为infra_server2并运行以下命令:

docker run -d -p 9802:8001 -v /path(or)location/of/edited/cotainer-scripts/in/your/hostSystem:/u01/oracle/container-scripts --network=InfraNET --volumes-from InfraAdminContainer --name InfraManagedContainer --env-file ./infraserver.env.list previously-committed-image startManagedServer.sh

For every new container I changed the server name in startNodeManager.sh and mounted it to the container in docker run command..

对于每个新容器,我在startNodeManager.sh中更改了服务器名称,并将其安装到docker run命令中的容器中。

I am sure there is a much simpler way to add more servers may be by using WLST scripting to add server instances in weblogic.. and also to start new managed server containers..

我确信有一种更简单的方法来添加更多服务器可能是通过使用WLST脚本在weblogic中添加服务器实例而且还可以启动新的托管服务器容器。

if anyone knows please let us know.

如果有人知道,请告诉我们。

Thanks!!

#1


0  

Here is what i did that helped me to set up Multiple managed servers .

以下是我所做的,它帮助我设置了多个托管服务器。

  • Initially i ran the following command which is from the instructions in container-registry.oracle.com:

    最初我运行了以下命令,该命令来自container-registry.oracle.com中的说明:

    docker run -d -p 9001:7001 --network=InfraNET -v $HOST_VOLUME:/u01/oracle/user_projects --name InfraAdminContainer --env-file ./infraDomain.env.list container-registry.oracle.com/middleware/fmw-infrastructure:12.2.1.2
    
  • Then I copied my edited Container-scripts into the Container-scripts in the Admin container.

    然后我将编辑好的Container-scripts复制到Admin容器中的Container-scripts中。

  • Deleted the already created domain directory from the container.

    从容器中删除已创建的域目录。

  • committed the container to a new image.

    将容器提交到新图像。

alternatively you can mount the edited files into container in docker run command.

或者,您可以在docker run命令中将已编辑的文件装入容器中。

I edited the createInfraDomain.py and createOrStartInfradomain.sh files in the container-scripts to create 6 infra-servers.This will create 6 infraserver instances and you will be able to see it in the weblogic console.

我在容器脚本中编辑了createInfraDomain.py和createOrStartInfradomain.sh文件以创建6个infra-servers。这将创建6个infraserver实例,您将能够在weblogic控制台中看到它。

Now use the following command to start the first Managed Server container:

现在使用以下命令启动第一个受管服务器容器:

docker run -d -p 9802:8001 --network=InfraNET --volumes-from InfraAdminContainer --name InfraManagedContainer --env-file ./infraserver.env.list previously-committed-image startManagedServer.sh

docker run -d -p 9802:8001 --network = InfraNET --volumes-来自InfraAdminContainer --name InfraManagedContainer --env-file ./infraserver.env.list previous-committed-image startManagedServer.sh

For startning a new managed server container I edited the startManagedServer.sh file and changed the server value to infra_server2 and ran the following command:

为了启动新的托管服务器容器,我编辑了startManagedServer.sh文件并将服务器值更改为infra_server2并运行以下命令:

docker run -d -p 9802:8001 -v /path(or)location/of/edited/cotainer-scripts/in/your/hostSystem:/u01/oracle/container-scripts --network=InfraNET --volumes-from InfraAdminContainer --name InfraManagedContainer --env-file ./infraserver.env.list previously-committed-image startManagedServer.sh

For every new container I changed the server name in startNodeManager.sh and mounted it to the container in docker run command..

对于每个新容器,我在startNodeManager.sh中更改了服务器名称,并将其安装到docker run命令中的容器中。

I am sure there is a much simpler way to add more servers may be by using WLST scripting to add server instances in weblogic.. and also to start new managed server containers..

我确信有一种更简单的方法来添加更多服务器可能是通过使用WLST脚本在weblogic中添加服务器实例而且还可以启动新的托管服务器容器。

if anyone knows please let us know.

如果有人知道,请告诉我们。

Thanks!!