ECS: API curl 명령을 사용하는 방법

Riepilogo: API(Application Programming Interface) curl 명령을 GET 및 PUT 예제와 함께 사용하는 방법

Questo articolo si applica a Questo articolo non si applica a Questo articolo non è legato a un prodotto specifico. Non tutte le versioni del prodotto sono identificate in questo articolo.

Istruzioni

이 기술 자료 문서에서는 ECS API를 사용하는 데 curl 명령을 사용하는 방법을 보여줍니다.

ECS 관리 가이드 또는 데이터 액세스 가이드와 같은 사용자 가이드에는 curl 명령과 함께 API를 사용하는 예가 있습니다.

curl 명령을 사용하여 API에서 GET 및 PUT을 수행하는 방법을 표시합니다. 이 예에서 KB ECS당 LDAPS 인증서 API는 다음과 같습니다. ECS에서 LDAPS를 통해 모든 인증서를 설정하고 수락하는 방법


curl 예 - LDAPS 인증서 API 예:
LDAPS 인증서 API는 관리 IP를 사용하고 emcmonitor 액세스를 허용하지 않고 루트 사용자를 허용합니다. ECS API 사용의 예로, LDAPS 인증서 API는 "/vdc/truststore"명령을 수행할 수 있는 충분한 공간이 있어야 합니다. API가 다르고 다른 위치에 있을 수 있습니다.

LDAPS 인증서 설정과 관련된 ECS 설정을 검토하려면 먼저 사용할 노드 관리 IP를 가져옵니다. UI 관리를 위해 네트워크가 분리되어 있는 경우 "getrackinfo -n"에는 "mgmt" 값이 있습니다. 노드 public.mgmt IP 주소를 사용하십시오. 다음 단계에서는 복제 및 데이터 네트워크 분리가 필요하지 않습니다.

# getrackinfo -n
Named networks
==============
Node ID       Network          Ip Address        Netmask            Gateway            VLAN               Interface
1            repl              10.xxx.xxx.11     255.255.254.0      xxx.xxx.xxx.xxx    14                 public
1            mgmt              10.xxx.xxx.21     255.255.254.0      xxx.xxx.xxx.xxx    13                 public
1            data              10.xxx.xxx.31     255.255.254.0      xxx.xxx.xxx.xxx    15                 public
2            repl              10.xxx.xxx.12     255.255.254.0      xxx.xxx.xxx.xxx    14                 public
2            mgmt              10.xxx.xxx.22     255.255.254.0      xxx.xxx.xxx.xxx    13                 public
2            data              10.xxx.xxx.32     255.255.254.0      xxx.xxx.xxx.xxx    15                 public
3            repl              10.xxx.xxx.13     255.255.254.0      xxx.xxx.xxx.xxx    14                 public
3            mgmt              10.xxx.xxx.23     255.255.254.0      xxx.xxx.xxx.xxx    13                 public
3            data              10.xxx.xxx.33     255.255.254.0      xxx.xxx.xxx.xxx    15                 public
4            repl              10.xxx.xxx.14     255.255.254.0      xxx.xxx.xxx.xxx    14                 public
4            mgmt              10.xxx.xxx.24     255.255.254.0      xxx.xxx.xxx.xxx    13                 public
4            data              10.xxx.xxx.34     255.255.254.0      xxx.xxx.xxx.xxx    15                 public

VDC에 네트워크 public.mgmt 분리가 없는 경우 노드의 공용 IP 주소를 대신 사용합니다. public.mgmt 네트워크 분리 주소가 설정된 경우 우선합니다.

# getrackinfo
Node private      Node              Public                                  BMC
Ip Address        Id       Status   Mac                 Ip Address          Mac                 Ip Address          Node Name
===============   ======   ======   =================   =================   =================   =================   =========
192.1XX.2XX.1     1        MA       a4:bf:xx:xx:xx:74   10.xx.xx.1          a4:bf:xx:xx:xx      192.1XX.2XX.101     provo-red
192.1XX.2XX.2     2        SA       a4:bf:xx:xx:xx:c8   10.xx.xx.2          a4:bf:xx:xx:xx      192.1XX.2XX.102     sandy-red
192.1XX.2XX.3     3        SA       a4:bf:xx:xx:xx:e0   10.xx.xx.3          a4:bf:xx:xx:xx      192.1XX.2XX.103     orem-red
192.1XX.2XX.4     4        SA       a4:bf:xx:xx:xx:56   10.xx.xx.4          a4:bf:xx:xx:xx      192.168.219.104     ogden-red

루트 사용자 토큰을 가져오려면 획득한 관리 IP 주소를 사용합니다. 루트 사용자 암호는 필수입니다.

# curl -s -k -v -u root https://<NodeManagementIP>:4443/login 2>&1

예:

# curl -s -k -v -u root https://10.xxx.xxx.21:4443/login 2>&1
Enter host password for user 'root':
......

< HTTP/1.1 200 OK
< Date: Thu, 14 Jan 2021 13:51:24 GMT
< Content-Type: application/xml
< Content-Length: 93
< Connection: keep-alive
< X-SDS-AUTH-TOKEN: BAAcdWhGbnVRVjd1WlpmR0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxAgAC0A8=
< X-SDS-AUTH-USERNAME: root
< X-SDS-AUTH-MAX-AGE: 28800
<
* Connection #0 to host 10.xxx.xxx.21 left intact
root

출력이 "HTTP/1.1 200 OK"가 아닌 경우 비밀번호와 IP 주소를 확인하고 명령에서 UI 관리 네트워크가 분리되어 있는지 확인하십시오.getrackinfo -n"로 이동되었습니다. 루트 사용자 토큰을 사용하여 토큰 변수를 생성하고 새 CLI 세션에 있는 경우 유효한 토큰을 업데이트해야 합니다.

# export TOKEN='X-SDS-AUTH-TOKEN: BAAcdWhGbnVRVjd1WlpmR0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxAgAC0A8='

토큰이 값인지 테스트하려면 다음 curl 명령을 실행합니다.

# curl -k -X GET -H "$TOKEN"  https://10.xxx.xxx.21:4443/object/capacity  | xmllint --format -        
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
100   176  100   176    0     0    249      0 --:--:-- --:--:-- --:--:--   250

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cluster_capacity>
  <totalFree_gb>100657</totalFree_gb>
  <totalProvisioned_gb>447005</totalProvisioned_gb>
</cluster_capacity>

위 단계의 목적은 루트 사용자 토큰을 사용하여 ECS UI 신뢰 저장소에 대한 curl 액세스 권한을 얻는 것입니다. "사용자 지정 LDAP 인증서 추가"에 대한 자세한 내용은 ECS 관리자 가이드를 참조하십시오. 이 ECS API 사용 예에서 LDAPS 인증서 API는 "/vdc/truststore"명령을 수행할 수 있는 충분한 공간이 있어야 합니다. API가 다른 위치에 있을 수 있습니다.

 

Curl GET 예제:

curl GET 명령을 사용하여 신뢰 저장소 설정을 가져옵니다.

# curl -s -k -X GET -H Content-Type:application/json -H "$TOKEN" -H ACCEPT:application/json https://<NodeManagementIP>:4443/vdc/truststore/settings

예:

# curl -s -k -X GET -H Content-Type:application/json -H "$TOKEN" -H ACCEPT:application/json https://10.xxx.xxx.21:4443/vdc/truststore/settings
{"accept_all_certificates":false}


위의 예에서 truststore "accept_all_certificates" false로 설정됩니다. 즉, AD/LDAP 서버 인증서와 일치하는 업로드된 LDAPS 인증서만 ECS에서 신뢰할 수 있습니다. 사용자는 필요에 따라 true 또는 false로 설정하기를 원할 수 있습니다. LDAPS 연결을 테스트하려면 이를 true로 설정하고 사용자 로그인을 테스트하면 유효성을 검사할 수 있습니다.

json 페이로드가 있는 curl 명령으로 신뢰 저장소 설정을 변경하려면 json 파일을 생성합니다.

# sudo vi truststoresettings.json
# sudo cat truststoresettings.json
{"accept_all_certificates": "true"}


Python의 json.tool 모듈은 json 파일 형식의 유효성을 검사할 수 있습니다. 오류가 있는 경우 파일이 json 파일이 아닐 수 있습니다. 이 예에서는 오류가 없고 파일을 출력하므로 형식이 지정된 json 파일입니다.

# python -m json.tool truststoresettings.json
{
    "accept_all_certificates": "true"
}

 

Curl PUT 예:

curl PUT 명령으로 json 파일을 페이로드로 사용하여 curl 명령을 실행합니다.

# curl -s -k -X PUT -H Content-Type:application/json -H "$TOKEN" -H ACCEPT:application/json https://:4443/vdc/truststore/settings -d @truststoresettings.json

업데이트가 되었는지 확인하려면 curl GET 명령을 실행합니다.

# curl -s -k -X GET -H Content-Type:application/json -H "$TOKEN" -H ACCEPT:application/json https://10.xxx.xxx.21:4443/vdc/truststore/settings
{"accept_all_certificates":true}

Prodotti interessati

ECS

Prodotti

ECS Appliance
Proprietà dell'articolo
Numero articolo: 000194272
Tipo di articolo: How To
Ultima modifica: 04 nov 2025
Versione:  4
Trova risposta alle tue domande dagli altri utenti Dell
Support Services
Verifica che il dispositivo sia coperto dai Servizi di supporto.