명령줄 도구#

plans-img 모든 플랜 에서 사용 가능

deployment-img self-hosted 배포

self-managed 배포에서는 Mattermost 서버가 설치된 디렉토리에서 시스템을 구성하기 위한 mattermost 명령을 사용할 수 있습니다. Mattermost 명령줄 인터페이스(CLI)에 대한 개요는 Santos의 이 글 을 참조하세요.

중요

Mattermost v6.0부터 이러한 CLI 명령의 대부분이 mmctl 명령줄 도구 을 사용하여 사용 가능한 동등한 명령으로 대체되었습니다. 그러나 mattermost import 명령, mattermost export 명령 및 관련 하위 명령은 Mattermost v6.0부터 계속 사용 가능하고 완전히 지원됩니다.

이러한 mattermost 명령에는 다음과 같은 기능이 포함됩니다:

규정 준수 내보내기

  • 데이터 내보내기

  • 내보내기 작업 예약

데이터베이스

  • 데이터베이스 초기화, 마이그레이션 실행 및 사용자 정의 기본값 로드

  • 적용되지 않은 마이그레이션을 위한 데이터베이스 스키마 마이그레이션

  • 데이터베이스를 초기 상태로 재설정

  • 가장 최근에 적용된 버전 번호 반환

  • 데이터베이스 마이그레이션 롤백

서버 작업

  • Mattermost 작업 서버 시작

  • Mattermost 서버 실행

  • Mattermost 버전 정보 표시

CLI 사용#

CLI 명령을 실행하려면 Mattermost 루트 디렉토리에 있어야 합니다. Mattermost의 기본 설치에서 루트 디렉토리는 /opt/mattermost 입니다. 표준 설치 프로세스 를 따랐다면 mattermost 사용자로 명령을 실행해야 합니다. 실행 파일의 이름은 mattermost 이며 /opt/mattermost/bin 디렉토리에서 찾을 수 있습니다.

예를 들어, Mattermost의 기본 설치에서 Mattermost 버전을 확인하려면:

cd /opt/mattermost/
sudo -u mattermost bin/mattermost version

참고

  • mattermost 사용자로 Mattermost 바이너리를 실행해야 합니다. root 사용자로 실행하면(예를 들어) CLI 명령을 실행할 때 바이너리가 플러그인을 초기화하고 다양한 파일에 접근하면서 권한 관련 문제가 발생할 수 있습니다. root 사용자로 서버를 실행하면 플러그인과 파일의 소유권이 덮어써지고 다른 잠재적인 권한 오류가 발생할 수 있습니다.

  • 데이터베이스에 구성이 저장된 Mattermost 설치에서 CLI 명령을 실행할 때 다음과 같이 데이터베이스 연결 문자열을 전달해야 할 수 있습니다:

    bin/mattermost --config="postgres://mmuser:mostest@localhost:5432/mattermost_test?sslmode=disable\u0026connect_timeout=10"
    

GitLab Omnibus에서는 CLI 명령을 실행할 때 다음 디렉토리에 있어야 합니다: /opt/gitlab/embedded/service/mattermost. 또한 mattermost 사용자로 명령을 실행하고 구성 파일의 위치를 지정해야 합니다. 실행 파일은 /opt/gitlab/embedded/bin/mattermost 입니다.

예를 들어, GitLab Omnibus에서 Mattermost 버전을 확인하려면:

cd /opt/gitlab/embedded/service/mattermost
sudo /opt/gitlab/embedded/bin/chpst -e /opt/gitlab/etc/mattermost/env -P -U mattermost:mattermost -u mattermost:mattermost /opt/gitlab/embedded/bin/mattermost version

참고

이 문서 페이지의 예제 명령은 Mattermost의 기본 설치용입니다. GitLab Omnibus에서 작동하도록 명령을 수정해야 합니다.

Docker 설치에서는 /mattermost/bin 디렉토리가 PATH``에 추가되어 있어 ``docker exec 명령으로 CLI를 직접 사용할 수 있습니다. docker-compose.yml 로 Mattermost를 설치한 경우 컨테이너 이름이 mattermostdocker_app_1 일 수 있습니다.

예를 들어, Docker 설치에서 Mattermost 버전을 확인하려면:

docker exec -it <your-mattermost-container-name> mattermost version

아래의 Docker 설치 탭 세부 정보와 명령 참조는 Mattermost docker preview image 에도 적용됩니다.

참고

  • CLI는 고가용성 환경 이 클러스터의 모든 노드에서 작업을 수행하는 데 사용하는 메커니즘을 우회하는 단일 노드에서 실행됩니다. 결과적으로 고가용성 환경에서 CLI 명령 을 실행할 때 구성 설정을 변경하는 작업은 서버 재시작이 필요합니다.

  • CLI 명령의 매개변수는 순서가 중요합니다.

  • 특수 문자(!, |, (, ), \, ', ")를 사용하는 경우, 전체 인수를 작은따옴표로 묶거나 개별 문자를 이스케이프 처리해야 합니다.

mattermost CLI 명령어#

설명

Mattermost 인스턴스와 사용자를 구성하고 관리하기 위한 명령어입니다.

옵션
-c, --config {string}           Configuration file to use. (default "config.json")
--disableconfigwatch {boolean}  When true, the config.json file will not be reloaded automatically when another process changes it (default "false")
하위 명령어

mattermost db#

설명

데이터베이스 관련 명령어

하위 명령어
  • mattermost db downgrade - 데이터베이스 마이그레이션을 롤백합니다. 롤백할 업데이트 계획이나 쉼표로 구분된 버전 번호가 필요합니다.

  • mattermost db init - 데이터베이스를 초기화하고, 마이그레이션을 실행하며, 사용자 정의 기본값을 로드합니다

  • mattermost db migrate - 적용되지 않은 마이그레이션에 대한 데이터베이스 스키마를 마이그레이션합니다

  • mattermost db reset - 데이터베이스를 초기 상태로 재설정합니다

  • mattermost db version - 가장 최근에 적용된 버전 번호 반환

옵션
-h, --help   help for db
-c, --config string   Configuration file to use

mattermost db downgrade#

설명

데이터베이스 마이그레이션을 롤백합니다. 롤백할 업데이트 계획 또는 쉼표로 구분된 버전 번호가 필요합니다.

형식
mattermost db downgrade
예시
mattermost db downgrade 99,100,101
옵션
--<plan-file> string      Runs the rollback migrations defined in the plan file.

mattermost db init#

설명

지정된 데이터 소스 이름(DSN)으로 데이터베이스를 초기화하고, 마이그레이션을 실행하며, 지정된 경우 사용자 정의 기본값을 로드합니다.

형식
mattermost db init
예시

DSN을 전달하려면 config 플래그를 사용하세요:

mattermost db init --config postgres://localhost/mattermost

MM_CONFIG 환경 변수를 사용하려면 이 명령어를 실행하세요:

MM_CONFIG=postgres://localhost/mattermost mattermost db init

데이터베이스에 로드할 사용자 정의 기본값 파일을 설정하려면 이 명령어를 실행하세요:

MM_CUSTOM_DEFAULTS_PATH=custom.json MM_CONFIG=postgres://localhost/mattermost mattermost db init

mattermost db migrate#

설명

적용되지 않은 마이그레이션이 있으면 데이터베이스 스키마를 마이그레이션합니다.

하위 명령어
형식
mattermost db migrate
예시
mattermost db migrate
옵션
--auto-recover bool     If the migration plan receives an error during migrations, this command will try to rollback migrations already applied within the plan. Not recommended without reviewing migration plan by combining --save-plan and --dry-run options.
--save-plan bool        Saves the plan for the migration into the file store so that it can be used for reviewing the plan or for downgrading.
--dry-run bool          Does not apply the migrations, but it validates how the migration would run based on the given conditions.

mattermost db reset#

설명

데이터베이스를 초기 상태로 재설정합니다. 애플리케이션 서버는 시작하지 않으며, 저장소 계층만 시작하고 migrations 테이블을 제외한 모든 테이블을 비웁니다.

형식
mattermost db reset
예시
bin/mattermost db reset

mattermost db version#

설명

가장 최근에 적용된 버전 번호를 반환합니다.

형식
mattermost db version

mattermost export#

참고

plans-img-yellow Enterprise 플랜에서만 사용 가능합니다.

설명

컴플라이언스 준수를 위한 데이터 내보내기와 여러 Mattermost 인스턴스 병합을 위한 명령어입니다.

하위 명령어

mattermost export actiance#

Mattermost v10.5부터 이 명령어는 사용 중단되었습니다. 향후 버전에서 mmctl 명령줄 도구에 추가될 예정입니다. 그때까지는 mattermost export schedule 명령어를 사용해 주세요.

mattermost export csv#

Mattermost v10.5부터 이 명령어는 사용 중단되었습니다. 향후 버전에서 mmctl 명령줄 도구에 추가될 예정입니다.

mattermost export global-relay-zip#

Mattermost v10.5부터 이 명령어는 사용 중단되었습니다. 향후 버전에서 mmctl 명령줄 도구에 추가될 예정입니다.

mattermost export schedule#

설명

타사 아카이브 시스템에 가져오기 적합한 형식으로 내보내기 작업을 예약합니다.

형식
mattermost export schedule
예시
bin/mattermost export schedule --exportFrom=1513102632
옵션
--exportFrom string     Unix timestamp (seconds since epoch, UTC) to export data from.
--timeoutSeconds string Set how long the export should run for before timing out.

mattermost export bulk#

Mattermost v6.0부터 이 명령어는 사용 중단되었으며, 데이터를 내보내는 공식적인 방법으로 mmctl export commands 를 사용하세요.


mattermost help#

설명

Mattermost 명령줄 도구에 대한 전체 문서를 Markdown 형식으로 생성합니다.

형식
mattermost help {outputdir}

mattermost import#

설명

Mattermost로 데이터를 가져옵니다.

하위 명령어

mattermost import bulk#

Mattermost v6.0부터 이 명령어는 더 이상 사용되지 않으며, 데이터를 가져오는 공식적인 방법으로 mmctl import commands 를 사용하세요.

mattermost import slack#

Slack 데이터를 Mattermost로 가져오는 권장 방법은 mmctl import commands 문서를 참고하세요.

설명

Slack 내보내기 zip 파일에서 팀을 가져옵니다.

형식

. code-block:: sh

mattermost import slack {team} {file}

예시
bin/mattermost import slack myteam slack_export.zip

mattermost jobserver#

설명

Mattermost 작업 서버를 시작합니다.

형식
mattermost jobserver
예시
bin/mattermost jobserver

mattermost server#

설명

Mattermost 서버를 실행합니다.

형식
mattermost server

mattermost version#

참고

Mattermost v6.5부터 이 CLI 명령어는 더 이상 데이터베이스와 상호작용하지 않습니다. 스키마 마이그레이션을 실행하려면 mattermost db migrate CLI 명령어가 도입되었습니다.

설명

Mattermost 버전 정보를 표시합니다.

형식
mattermost version

문제 해결#

명령어 실행이 멈추고 완료되지 않음#

Bleve 검색 인덱싱이 활성화되어 있다면, System Console > Experimental > Bleve 에서 일시적으로 비활성화한 후 명령어를 다시 실행하세요. 또는 새롭게 제공되는 mmctl Command Line Tool 을 사용할 수도 있습니다.

Bleve는 여러 프로세스가 동일한 인덱스를 동시에 열고 조작하는 것을 지원하지 않습니다. 따라서 Mattermost 서버가 실행 중일 때 CLI를 실행하려고 하면 인덱스를 열 때 잠길 수 있습니다.

Bleve 검색 인덱싱을 사용하지 않는 경우, 도움이 필요하다면 언제든지 Troubleshooting forum 에 글을 남겨주세요.