Развертывание приложений на сервере приложений JBoss из командной строки - PullRequest
18 голосов
/ 09 декабря 2011

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

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

Ответы [ 4 ]

30 голосов
/ 13 декабря 2011

Это можно сделать тремя способами на Сервере приложений JBoss 7 :

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

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

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

Imgur

CLI управления

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

Вот deploy:

[standalone@localhost: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:

[standalone@localhost: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 в действии

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

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

[user@home EAP_HOME]$ cd bin

Запустите сценарий входа в систему CLI:

[user@host 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 для отображения доступных приложений.

[standalone@localhost:9999 /] undeploy
test.ear

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

[standalone@localhost:9999 /] undeploy test.ear
Successfully undeployed test.ear.

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

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

3 голосов
/ 09 декабря 2011

С сервером приложений JBoss возможно развертывание с простыми файловыми операциями на войнах / ушах в deploy dir.

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

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

2 голосов
/ 06 июня 2013

Вы также можете попробовать CLI GUI. Параметр меню Deployments -> Undeploy предоставляет список выбора развертываний. Пару кликов и все готово.

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

0 голосов
/ 13 февраля 2014

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

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

Сообщите всем, если у вас есть какие-либо вопросы по этому поводу.

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

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...