如何从 Rackspace 云服务器内部找出服务器信息(id、IP 等)?
如何从服务器本身查找有关 Rackspace 云服务器的信息?
亚马逊 AWS 有它,其记录如下: http ://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html?r=7479
How can I find information about a Rackspace Cloud server from within the server itself?
Amazon AWS has it, and its documented here: http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html?r=7479
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 Rackspace 云服务器 API:http://www.rackspace.com/cloud /cloud_hosting_products/servers/api/
这里有一个 python 实现:http://packages.python.org/python-cloudservers/
或命令行工具也非常有用:http://jsquaredconsulting.com/blog/2010/11/rscurl-a-rackspace-cloud-server-command-line-tool/
这是最实用的链接/\
You could use the Rackspace Cloud Server API: http://www.rackspace.com/cloud/cloud_hosting_products/servers/api/
There's a python implementation here: http://packages.python.org/python-cloudservers/
or the command line tool is really useful too: http://jsquaredconsulting.com/blog/2010/11/rscurl-a-rackspace-cloud-server-command-line-tool/
That's the most practical link /\
从您的应用程序代码中,您可以使用此处描述的技术(对于 C#)找到本地服务器自己的外部 IP 地址:https: //stackoverflow.com/a/1069113/12484
然后,一旦获得 IP 地址,您就可以使用 Rackspace Cloud API 查询所有活动服务器的列表,并获取以下信息:具有匹配 IP 地址的服务器。示例代码(C#,使用 OpenStack.net SDK):
USERNAME
,上述代码中的 API_KEY
和REGION
应替换为您自己的 Rackspace 云帐户的实际值。From your application code, you can find the local server's own external IP address using a technique like the one described here (for C#): https://stackoverflow.com/a/1069113/12484
Then, once you have the IP address, you can use the Rackspace Cloud API to query the list of all active servers, and get the information for the server with the matching IP address. Sample code (C#, using the OpenStack.net SDK):
USERNAME
,API_KEY
, andREGION
in the above code should be replaced by the actual values for your own Rackspace Cloud account.