ECS: cómo probar S3 para crear un depósito, cargar un objeto, leer un objeto, eliminar un objeto y eliminar un depósito con el script s3test.sh

摘要: Cómo probar la creación del depósito, la carga del objeto, la lectura del objeto, la eliminación del objeto y la eliminación del depósito de S3 con el script de s3test.

本文章適用於 本文章不適用於 本文無關於任何特定產品。 本文未識別所有產品版本。

說明

Antes de continuar, revise el siguiente artículo de la base de conocimientos relacionado con s3curl para ayudar a confirmar la funcionalidad de S3: 
ECS: Cómo realizar operaciones básicas de S3 mediante el script de s3curl.pl.


1: Inicie sesión en el nodo de ECS a través de SSH como usuario raíz.

2: Utilice vi para crear el archivo: 
  /usr/share/s3curl/s3test.sh

3: Copie el siguiente contenido en el archivo. Asegúrese de modificar las IP de DESTINO para que coincidan con las de su ECS, ya que el script se ejecuta en cualquier IP que se coloque en el DESTINO. Con respecto al S3CURL_ID, consulte ECS: Cómo realizar operaciones básicas de S3 con el script de s3curl.pl.

!/bin/bash
TARGET="10.xx.xx.xx7 10.xx.xx.xx8 10.xx.xx.xx9 10.xx.xx.xx0"
S3CURL="/usr/share/s3curl/s3curl.pl"
S3CURL_ID="--id=friendlymick"
OBJECT_NAME="newfile"cat
echo "s3curl upload test" > $OBJECT_NAME
PASS="echo -e \e[32mPASSED\e[0m"
FAIL="echo -e \e[31mFAILED\e[0m"

for ip in $(echo $TARGET)
do
  echo
  echo "Node - $ip"
  BUCKET_NAME="bucket_$(date +%d%b_%H%M)_${ip}"
  echo "Bucket/Object name: $BUCKET_NAME/$OBJECT_NAME"
  echo "---------------------------------------------------------"

  # Test bucket  creation
  echo -n "Create Bucket: "
  STATUS=$($S3CURL $S3CURL_ID --createBucket -- http://${ip}:9020/${BUCKET_NAME} -s -w "%{http_code}" -o /dev/null 2> /dev/null)
  test ${STATUS:-0} -eq 200 && $PASS || { $FAIL; continue; }

  # Upload Object
  echo -n "Upload Object: "
  STATUS=$($S3CURL $S3CURL_ID --put $OBJECT_NAME -- http://${ip}:9020/${BUCKET_NAME}/${OBJECT_NAME} -s -w "%{http_code}" -o /dev/null 2> /dev/null)
  test ${STATUS:-0} -eq 200 && $PASS || $FAIL

  # Read Object
  echo -n "Read Object:   "
  STATUS=$($S3CURL $S3CURL_ID -- http://${ip}:9020/${BUCKET_NAME}/${OBJECT_NAME} -s 2> /dev/null)
  test "$STATUS" == "s3curl upload test" && $PASS || $FAIL

  # Delete Object
  echo -n "Delete Object: "
  STATUS=$($S3CURL $S3CURL_ID --delete -- http://${ip}:9020/${BUCKET_NAME}/${OBJECT_NAME} -s -w "%{http_code}" -o /dev/null 2> /dev/null)
  test ${STATUS:-0} -eq 204 && $PASS || $FAIL

  # Delete Bucket
  echo -n "Delete Bucket: "
  STATUS=$($S3CURL $S3CURL_ID --delete -- http://${ip}:9020/${BUCKET_NAME} -s -w "%{http_code}" -o /dev/null 2> /dev/null)
  test ${STATUS:-0} -eq 204 && $PASS || $FAIL

  # Verifying Deletion
  echo -n "Verify Deletion of bucket: "
  STATUS=$($S3CURL $S3CURL_ID -- http://${ip}:9020/${BUCKET_NAME} -s -w "%{http_code}" -o /dev/null 2> /dev/null)
  test ${STATUS:-0} -eq 404 && $PASS || $FAIL
done


4: Ejecute el siguiente comando para ejecutar el script:  
   # sh s3test.sh

Todas las pruebas deben regresar como superadas. Si algunas pruebas no resultan como APROBADAS, comuníquese con el soporte de ECS.

provo:/usr/share/s3curl # sh s3test.sh

Node - 10.xx.xx.xx7
Bucket/Object name: bucket_14Apr_1009_10.xx.xx.xx7/newfile
---------------------------------------------------------
Create Bucket: PASSED
Upload Object: PASSED
Read Object:   PASSED
Delete Object: PASSED
Delete Bucket: PASSED
Verify Deletion of bucket: PASSED

Node - 10.xx.xx.xx8
Bucket/Object name: bucket_14Apr_1009_10.xx.xx.xx8/newfile
---------------------------------------------------------
Create Bucket: PASSED
Upload Object: PASSED
Read Object:   PASSED
Delete Object: PASSED
Delete Bucket: PASSED
Verify Deletion of bucket: PASSED

Node - 10.xx.xx.xx9
Bucket/Object name: bucket_14Apr_1009_10.xx.xx.xx9/newfile
---------------------------------------------------------
Create Bucket: PASSED
Upload Object: PASSED
Read Object:   PASSED
Delete Object: PASSED
Delete Bucket: PASSED
Verify Deletion of bucket: PASSED

Node - 10.xx.xx.xx0
Bucket/Object name: bucket_14Apr_1009_10.xx.xx.xx0/newfile
---------------------------------------------------------
Create Bucket: PASSED
Upload Object: PASSED
Read Object:   PASSED
Delete Object: PASSED
Delete Bucket: PASSED
Verify Deletion of bucket: PASSED

受影響的產品

ECS Appliance Hardware Gen1 U-Series

產品

ECS Appliance Hardware Gen1 U-Series, ECS Appliance Software with Encryption, ECS Appliance Software without Encryption
文章屬性
文章編號: 000023816
文章類型: How To
上次修改時間: 08 9月 2025
版本:  6
向其他 Dell 使用者尋求您問題的答案
支援服務
檢查您的裝置是否在支援服務的涵蓋範圍內。