curl上传文件到minio服务器
匿名用户上传
#!/bin/bash
bucket=mybucket
file=/home/database.yml
host=192.168.24.9:9000
resource="/${bucket}/${file}"
content_type="application/octet-stream"
date=`date -R`
echo $resource
echo "http://$host${resource}"
curl -v -X PUT -T "${file}" \
-H "Host: $host" \
-H "Date: ${date}" \
-H "Content-Type: ${content_type}" \
http://$host${resource}
使用账号密码上传
#!/bin/bash
ACCESS_KEY="minioadmin"
SECRET_KEY="minioadmin"
BUCKET_NAME="mybucket"
FILE_NAME="/home/database.yml"
OBJECT_NAME="database.yml"
MINIO_URL="192.168.24.9:9000"
# 生成日期和签名
DATE_VALUE="$(date -R)"
SIGNATURE="$(echo -en "PUT\n\n\n${DATE_VALUE}\n/${BUCKET_NAME}/${OBJECT_NAME}" | openssl sha1 -hmac "${SECRET_KEY}" -binary | base64)"
curl -i -X PUT --upload-file "${FILE_NAME}" \
--header "Date: ${DATE_VALUE}" \
--header "Authorization: AWS ${ACCESS_KEY}:${SIGNATURE}" \
"${MINIO_URL}/${BUCKET_NAME}/${OBJECT_NAME}"
原文地址:https://blog.csdn.net/lu_linux/article/details/144074517
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!