DBFS CLI(레거시)

Important

이 설명서는 사용 중지되었으며 업데이트되지 않을 수 있습니다.

이 정보는 레거시 Databricks CLI 버전 0.18 이하에 적용됩니다. Databricks는 최신 Databricks CLI 버전 0.205 이상을 대신 사용하는 것이 좋습니다. Databricks CLI란?을 참조하세요. Databricks CLI 버전을 찾으려면 다음을 실행 databricks -v합니다.

Databricks CLI 버전 0.18 이하에서 Databricks CLI 버전 0.205 이상으로 마이그레이션하려면 Databricks CLI 마이그레이션을 참조하세요.

Databricks DBFS CLI 하위 명령을 실행하여 databricks fs(또는 별칭 dbfs)에 추가합니다. 그러면 모든 DBFS 경로에 dbfs:/가 접두사로 추가됩니다. 이러한 하위 명령은 DBFS API호출합니다.

databricks fs -h
Usage: databricks fs [OPTIONS] COMMAND [ARGS]...

  Utility to interact with DBFS. DBFS paths are all prefixed
  with dbfs:/. Local paths can be absolute or local.

Options:
  -v, --version
  -h, --help     Show this message and exit.

Commands:
  cat        Shows the contents of a file. Does not work for directories.
  configure
  cp         Copies files to and from DBFS.
    Options:
      -r, --recursive
      --overwrite     Overwrites files that exist already.
  ls         Lists files in DBFS.
    Options:
      --absolute      Displays absolute paths.
      -l              Displays full information including size and file type.
  mkdirs     Makes directories in DBFS.
  mv         Moves a file between two DBFS paths.
  rm         Removes files from DBFS.
    Options:
      -r, --recursive

10k 이상의 파일을 나열, 이동 또는 삭제하는 작업의 경우 DBFS CLI를 사용하지 않을 것을 강력하게 권장합니다.

  • list 작업(databricks fs ls)은 약 60년 후에 시간이 초과됩니다.
  • move 작업(databricks fs mv)은 약 60년 후에 시간이 초과되며 데이터가 부분적으로 이동될 수 있습니다.
  • delete 작업(databricks fs rm)은 파일의 일괄 처리를 증분 방식으로 삭제합니다.

파일 시스템 유틸리티(dbutils.fs)를 사용하여 클러스터의 컨텍스트에서 이러한 작업을 수행하는 것이 좋습니다. dbutils.fs는 DBFS REST API의 기능 범위를 다루며 Notebook에서 적용됩니다. Notebook을 사용하여 이러한 작업을 실행하면 선택적으로 삭제, 관리 효율성 및 정기적인 작업을 자동화할 수 있는 가능성 등 더 나은 제어를 제공합니다.

제한 사항

방화벽이 활성화된 스토리지 컨테이너에 Databricks DBFS CLI의 사용은 지원되지 않습니다. Databricks는 Databricks 커넥트 또는 az storage를 사용하는 것이 좋습니다.

파일 내용을 나열

사용 설명서를 표시하려면 databricks fs cat --help를 실행합니다.

databricks fs cat dbfs:/tmp/my-file.txt
Apache Spark is awesome!

파일 복사

사용 설명서를 표시하려면 databricks fs cp --help를 실행합니다.

databricks fs cp dbfs:/tmp/your_file.txt dbfs:/parent/child/grandchild/my_file.txt --overwrite

성공하면 이 명령은 아무 것도 표시하지 않습니다.

파일 및 디렉터리에 대한 정보 나열

사용 설명서를 표시하려면 databricks fs ls --help를 실행합니다.

databricks fs ls dbfs:/tmp --absolute -l
file  42408084  dbfs:/tmp/LoanStats.csv    1590005159000
file        40  dbfs:/tmp/file_b.txt       1603991038000
dir          0  dbfs:/tmp/hive                         0
dir          0  dbfs:/tmp/mlflow                       0
file       385  dbfs:/tmp/multi-line.json  1597770632000
dir          0  dbfs:/tmp/new                          0
dir          0  dbfs:/tmp/parent                       0
file       243  dbfs:/tmp/test.json        1597770628000
file        40  dbfs:/tmp/test_dbfs.txt    1603989162000

디렉터리 만들기

사용 설명서를 표시하려면 databricks fs mkdirs --help를 실행합니다.

databricks fs mkdirs dbfs:/tmp/new-dir

성공하면 이 명령은 아무 것도 표시하지 않습니다.

파일 이동

사용 설명서를 표시하려면 databricks fs mv --help를 실행합니다.

databricks fs mv dbfs:/tmp/my-file.txt dbfs:/parent/child/grandchild/my-file.txt

성공하면 이 명령은 아무 것도 표시하지 않습니다.

파일 삭제

사용 설명서를 표시하려면 databricks fs rm --help를 실행합니다.

databricks fs rm dbfs:/tmp/parent/child/grandchild/my-file.txt
Delete finished successfully.