Подтвердить что ты не робот

Развертывание приложений в JBoss Application Server из командной строки

Есть ли какие-либо простые способы увидеть, какие войны были развернуты в Jboss AS и удалить некоторые из них? Я хочу сделать это из командной строки.

Я попытался использовать jmx, но я продолжаю получать исключение, говоря "org.jboss.util.NestedRuntimeException: jmx not bound;" Я бы предпочел сделать это так, чтобы мне не пришлось останавливаться и запускать сервер приложений.

4b9b3361

Ответ 1

Вы можете сделать это тремя способами в JBoss Application Server 7:

  • Консоль управления
  • CLI управления
  • Папка развертывания

Консоль управления

Будучи графическим интерфейсом, консоль управления является наиболее визуальной из трех, и вы можете увидеть список развернутых приложений в окне "Развертывание". Вы можете отключить и удалить развернутые приложения, перечисленные здесь. Этот скриншот от AS7.0.2, и некоторые окна имеют и будут меняться с добавлением вкладок, но общая функциональность остается неизменной.

Imgur

CLI управления

Интерфейс командной строки управления является новым дополнением к AS7. CLI предоставляет множество низкоуровневых функций и является мощным инструментом, когда вы знакомы с командами и операциями. Как и следовало ожидать, вы можете запустить help, чтобы показать команды, или запустите <commandname> --help для получения дополнительной информации о конкретной команде. Две полезные команды: deploy и undeploy, поэтому давайте посмотрим на их справочную информацию. Я приведу примеры Linux, но вы можете вставить свой вкус ОС по мере необходимости.

Здесь deploy:

[[email protected]:9999 /] deploy --help
SYNOPSIS

    deploy (file_path [--name=deployment_name] [--runtime_name=deployment_runtime_name] [--force] | --name=deployment_name) [--server-groups=group_name (,group_name)* | --all-server-groups]

DESCRIPTION

    Deploys the application designated by the file_path or enables an already existing
    but disabled in the repository deployment designated by the name argument.
    If executed w/o arguments, will list all the existing deployments.

ARGUMENTS

 file_path           - the path to the application to deploy. Required in case the deployment
                       doesn't exist in the repository.
                       The path can be either absolute or relative to the current directory.

 --name              - the unique name of the deployment. If the file path argument is specified
                       the name argument is optional with the file name been the default value.
                       If the file path argument isn't specified then the command is supposed to
                       enable an already existing but disabled deployment, and in this case the
                       name argument is required.

 --runtime_name      - optional, the runtime name for the deployment.

 --force             - if the deployment with the specified name already exists, by default,
                       deploy will be aborted and the corresponding message will printed.
                       Switch --force (or -f) will force the replacement of the existing deployment
                       with the one specified in the command arguments.

 --server-groups     - comma separated list of server group names the deploy command should apply to.
                       Either server-groups or all-server-groups is required in the domain mode.
                       This argument is not applicable in the standalone mode.

 --all-server-groups - indicates that deploy should apply to all the available server groups.
                       Either server-groups or all-server-groups is required in domain mode.
                       This argument is not applicable in the standalone mode.

 -l                  - in case none of the required arguments is specified the command will
                       print all of the existing deployments in the repository. The presence of the -l switch
                       will make the existing deployments printed one deployment per line, instead of
                       in columns (the default).

И здесь undeploy:

[[email protected]:9999 /] undeploy --help
SYNOPSIS

    undeploy name [--server-groups=group_name (,group_name)* | --all-relevant-server-groups] [--keep-content]

DESCRIPTION

    Undeploys the deployment with the given name and, depending on the arguments, removes
    its content from the repository.
    If the deployment name isn't specified, prints the list of all the existing deployments.

ARGUMENTS

 name                   - the name of the deployment to undeploy.

 --server-groups        - comma separated list of server group names the undeploy command should apply to.
                          Either server-groups or all-relevant-server-groups is required in the domain mode.
                          This argument is not applicable in the standalone mode.

 --all-relevant-server-groups   - indicates that undeploy should apply to all the server groups
                                  in which the deployment is enabled.
                                  Either server-groups or all-relevant-server-groups is required in domain mode.
                                  This argument is not applicable in the standalone mode.

 --keep-content         - by default undeploy, besides disabling the deployment, also removes its
                          content from the repository. The presence of --keep-content will only disable
                          the deployment w/o removing its content from the repository.
                          This argument can be used in both standalone and domain modes.

 -l                     - in case the deployment name isn't specified, the presence of the -l switch
                          will make the existing deployments printed one deployment per line, instead of
                          in columns (the default).

CLI In Action

Запуск команды deploy или undeploy без каких-либо аргументов приведет к отображению всех доступных приложений. Таким образом, ваш рабочий процесс для входа в CLI и развертывания приложения будет таким (упрощенным):

Измените каталог из EAP_HOME в папку bin:

[[email protected] EAP_HOME]$ cd bin

Запустите вход в систему CLI script:

[[email protected] bin]$ ./jboss-admin.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.

Попросите API подключиться (это также можно передать во время выполнения как ./jboss-admin.sh --connect).

[disconnected /] connect
Connected to standalone controller at localhost:9999

Запустите команду undeploy для отображения доступных приложений.

[[email protected]:9999 /] undeploy
test.ear

Запустите команду undeploy, чтобы развернуть приложение. В этом случае test.ear.

[[email protected]:9999 /] undeploy test.ear
Successfully undeployed test.ear.

Папка развертывания

Если вы используете экземпляр AS7 в качестве инструмента разработки и используете папку развертывания, вы можете просто удалить приложение. Вы заметите, что файл маркера создан, например test.ear.failed, чтобы указать статус развертывания приложения.

Ответ 2

С JBoss Application Server он может обрабатывать развертывание с помощью обычных файловых операций на ворах/ушах в каталоге deploy.

Просто ls для перечисления, delete для развертывания, copy для развертывания и touch для повторного развертывания. Не требуется перезагрузка сервера.

Также для новейшей версии JBoss Application Server 7 вы можете использовать CLI.

Ответ 3

Вы также можете попробовать CLI GUI. Параметр "Развертывания → Undeploy" предоставляет список развертываний. Несколько кликов, и все готово.

См. https://community.jboss.org/wiki/AGUIForTheCommandLineInterface

Ответ 4

Вам не нужно перезапускать сервер JBOSS, если вы удаляете WAR и EAR, приложение становится незанятым.

Статья (http://docs.jboss.org/jbossas/docs/Clustering_Guide/4/html/clustering-intro-farm.html) дает полное объяснение того, как она работает.

Пусть все знают, есть ли у вас какие-либо вопросы по этому поводу.

Мы работаем над разработкой Jboss таким же образом в нашей среде DEV, QA и Prod и не сталкивались с какими-либо проблемами с ней до сих пор.