一、测试S3访问 root@node4:~# apt-get install python-boto root@node4:~# vim s2test.py import boto import boto.s3.connection access_key = 'SSCRZQ0L7O6UM71OYV7H' secret_key = '8VQ8Gr5CaxL5ZokorupYbf5xQ AXYqA KFa4OlZ ' conn = boto.connect_s3( aws_access_key_id = access_key, aws_secret_access_key = secret_key, #host = '{hostname}' host = 'node4', is_secure=False, calling_format = boto.s3.connection.OrdinaryCallingFormat(), ) bucket = conn.create_bucket('my-new-bucket-node4') for bucket in conn.get_all_buckets(): print "{name}t{created}".format( name = bucket.name, created = bucket.creation_date, ) root@node4:~# python s2test.py 说明:access_key和secret_key需修改成被测试的用户的access_key和secret_key。 二、下载s3cmd安装包并安装 下载地址:https://sourceforge.net/projects/s3tools/files/s3cmd/ 我们这里选择s3cmd-1.5.2.tar.gz版本。 root@node4:~# tar -zxvf s3cmd-1.5.2.tar.gz root@node4:~# cd s3cmd-1.5.2 root@node4:~# apt-get install python-setuptools root@node4:~# python setup.py install root@node4:~# s3cmd --configure 注意:access_key和secret_key需分别配置成S3用户的access_key和secret_key 配置完成后会生成/root/.s3cfg文件,我们修改该文件中的host_base和host_bucket两项,用主机名替代原有网址。 root@node4:~# vim /root/.s3cfg host_base = node4 host_bucket = %(bucket)s.node4 root@node4:~# ln -s /s3cmd-1.5.2/build/scripts-2.7/s3cmd /usr/bin/s3cmd 三、安装dnsmasq root@node4:~# apt-get install dnsmasq root@node4:~# vim /etc/dnsmasq.conf address = /node4/192.168.107.24(node4为主机名,192.168.107.24为该主机的IP地址) listen-address = 127.0.0.1 root@node4:~# service dnsmasq restart
安装s3cmd
2020-01-06 12:26:06
浏览数 (1)