-
-
Save alistairncoles/b7d67db06eda62d4bed2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swift@saio-1:~/swift$ ls /mnt/sdb1/2/node/sdb2/objects/67/df9/10d5773cd70408b48b48246de59f7df9/ | |
1425992084.29355.data | |
swift@saio-1:~/swift$ python ./anc/metawriter.py /mnt/sdb1/2/node/sdb2/objects/67/df9/10d5773cd70408b48b48246de59f7df9/ '{"X-Object-Meta-Me": "wrote this", "X-Object-Sysmeta-Stuff": "system stuff"}' | |
{u'X-Object-Sysmeta-Stuff': u'system stuff', u'X-Object-Meta-Me': u'wrote this', 'X-Timestamp': '1425993014.14010', 'name': '/a/bogus/path'} | |
swift@saio-1:~/swift$ ls /mnt/sdb1/2/node/sdb2/objects/67/df9/10d5773cd70408b48b48246de59f7df9/1425992084.29355.data 1425993014.14010.meta | |
swift@saio-1:~/swift$ ./bin/swift-object-info /mnt/sdb1/2/node/sdb2/objects/67/df9/10d5773cd70408b48b48246de59f7df9/142599 | |
1425992084.29355.data 1425993014.14010.meta | |
swift@saio-1:~/swift$ ./bin/swift-object-info /mnt/sdb1/2/node/sdb2/objects/67/df9/10d5773cd70408b48b48246de59f7df9/1425993014.14010.meta | |
Path: /a/bogus/path | |
Account: a | |
Container: bogus | |
Object: path | |
Object hash: cf91ca7bbda2945dd1c015f77377f748 | |
Content-Type: Not found in metadata | |
Timestamp: 2015-03-10T13:10:14.140100 (1425993014.14010) | |
User Metadata: {u'X-Object-Sysmeta-Stuff': u'system stuff', u'X-Object-Meta-Me': u'wrote this'} | |
ETag: Not found in metadata | |
Content-Length: Not found in metadata | |
Partition 830 | |
Hash cf91ca7bbda2945dd1c015f77377f748 | |
Server:Port Device 127.0.0.1:6030 sdb3 | |
Server:Port Device 127.0.0.1:6020 sdb2 | |
Server:Port Device 127.0.0.1:6040 sdb4 | |
Server:Port Device 127.0.0.1:6010 sdb1 [Handoff] | |
curl -I -XHEAD "http://127.0.0.1:6030/sdb3/830/a/bogus/path" -H "X-Backend-Storage-Policy-Index: 0" | |
curl -I -XHEAD "http://127.0.0.1:6020/sdb2/830/a/bogus/path" -H "X-Backend-Storage-Policy-Index: 0" | |
curl -I -XHEAD "http://127.0.0.1:6040/sdb4/830/a/bogus/path" -H "X-Backend-Storage-Policy-Index: 0" | |
curl -I -XHEAD "http://127.0.0.1:6010/sdb1/830/a/bogus/path" -H "X-Backend-Storage-Policy-Index: 0" # [Handoff] | |
Use your own device location of servers: | |
such as "export DEVICE=/srv/node" | |
ssh 127.0.0.1 "ls -lah ${DEVICE:-/srv/node*}/sdb3/objects/830/748/cf91ca7bbda2945dd1c015f77377f748" | |
ssh 127.0.0.1 "ls -lah ${DEVICE:-/srv/node*}/sdb2/objects/830/748/cf91ca7bbda2945dd1c015f77377f748" | |
ssh 127.0.0.1 "ls -lah ${DEVICE:-/srv/node*}/sdb4/objects/830/748/cf91ca7bbda2945dd1c015f77377f748" | |
ssh 127.0.0.1 "ls -lah ${DEVICE:-/srv/node*}/sdb1/objects/830/748/cf91ca7bbda2945dd1c015f77377f748" # [Handoff] | |
note: `/srv/node*` is used as default value of `devices`, the real value is set in the config file on each storage node. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os.path | |
import sys | |
import time | |
from swift.common.utils import normalize_timestamp | |
from swift.obj.diskfile import write_metadata, read_metadata | |
if __name__ == '__main__': | |
args = sys.argv | |
path_to_file = args[1] | |
metadata = json.loads(args[2]) | |
ts = normalize_timestamp(time.time()) | |
metadata['X-Timestamp'] = ts | |
metadata['name'] = '/a/bogus/path' | |
filename = os.path.join(path_to_file, ts + '.meta') | |
with open(filename, 'wb') as f: | |
write_metadata(f, metadata) | |
with open (filename, 'rb') as f: | |
print read_metadata(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment