文档

使用示例

更新时间:

本文主要介绍如何使用阿里云数据库文件存储服务DBFS。

权限要求

  • 读操作:root用户、普通用户均支持读操作。

  • 写操作:仅root用户支持进行写操作。

场景示例

以下代码示例展示了在DBFS中创建文件、删除文件等基础操作。

[root@iZbp156ycm6s06xj******* ~]# df -h
文件系统    容量 已用 可用 已用% 挂载点
devtmpfs     16G   0  16G  0% /dev
tmpfs      16G 288K  16G  1% /dev/shm
dbfs_server   100G  46M 100G  1% /mnt/dbfs/hgsrb6i8****/dbfs-ytr9rtr9tgvwyrv*******

[root@iZbp156ycm6s06xj******* ~]# cd /mnt/dbfs/hgsrb6i8ebd4/dbfs-ytr9rtr9tgvwyrv*******
[root@iZbp156ycm6s06xj******* dbfs-ytr9rtr9tgvwyrv*******]# echo "dbfs test" >> test.txt
[root@iZbp156ycm6s06xj******* dbfs-ytr9rtr9tgvwyrv*******]# cat test.txt
dbfs test
[root@iZbp156ycm6s06xj******* dbfs-ytr9rtr9tgvwyrv*******]# cp /etc/fstab ./
[root@iZbp156ycm6s06xj******* dbfs-ytr9rtr9tgvwyrv*******]# touch a.txt
[root@iZbp156ycm6s06xj******* dbfs-ytr9rtr9tgvwyrv*******]# ls -lrt
总用量 2048
-rw-r--r-- 1 root root 10 2月 13 10:56 test.txt
-rw-r--r-- 1 root root 313 2月 13 10:57 fstab
-rw-r--r-- 1 root root  0 2月 13 10:57 a.txt
[root@iZbp156ycm6s06xj******* dbfs-ytr9rtr9tgvwyrv*******]# rm a.txt
rm:是否删除普通空文件 "a.txt"?y
[root@iZbp156ycm6s06xj******* dbfs-ytr9rtr9tgvwyrv*******]# ls -lrt
总用量 2048
-rw-r--r-- 1 root root 10 2月 13 10:56 test.txt
-rw-r--r-- 1 root root 313 2月 13 10:57 fstab

# 跟ext4使用一样,启动MySQL数据库。(MySQL数据库安装可以参考文档MySQL存储计算分离实践)
# MySQL二进制位于DBFS服务目录中。
/mnt/dbfs/hgsrb6i8****/dbfs-ytr9rtr9tgvwyrv*******/mysql-5.7.26/bin/mysqld --defaults-file=/mnt/dbfs/hgsrb6i8****/dbfs-ytr9rtr9tgvwyrv*******/my.cnf --user=root &
                        

  • 本页导读 (0)
文档反馈