ceph-deploy的rgw命令
2017-12-08 14:42
309 查看
ceph-deploy的rgw命令用于将conf_data 和key 写入到远程host中,并启动ceph-radosg和ceph.target 其入口函数为E:\ceph-deploy-master\ceph-deploy-master\ceph_deploy\rgw.py 中的make函数 @priority(30) def make(parser): """ Ceph RGW daemon management """ rgw_parser = parser.add_subparsers(dest='subcommand') rgw_parser.required = True rgw_create = rgw_parser.add_parser( 'create', help='Create an RGW instance' ) rgw_create.add_argument( 'rgw', metavar='HOST[:NAME]', nargs='+', type=colon_separated, help='host (and optionally the daemon name) to deploy on. \ NAME is automatically prefixed with \'rgw.\'', ) parser.set_defaults( func=rgw, ) make 函数为rgw 命令实现一个create的子命令,并指定了一个位置参数rgw,指定了子命令create的处理函数 是rgw def rgw(args): if args.subcommand == 'create': rgw_create(args) else: LOG.error('subcommand %s not implemented', args.subcommand) 如果子命令是create的话,则调用rgw_create,否则输出error def rgw_create(args): conf_data = conf.ceph.load_raw(args) LOG.debug( 'Deploying rgw, cluster %s hosts %s', args.cluster, ' '.join(':'.join(x or '' for x in t) for t in args.rgw), ) key = get_bootstrap_rgw_key(cluster=args.cluster) bootstrapped = set() errors = 0 for hostname, name in args.rgw: try: #通过形参args.rgw 中的hostname 得到远程机器的代理distro distro = hosts.get(hostname, username=args.username) rlogger = distro.conn.logger LOG.info( 'Distro info: %s %s %s', distro.name, distro.release, distro.codename ) LOG.debug('remote host will use %s', distro.init) if hostname not in bootstrapped: #这里的bootstrapped 是空的,所以这个条件肯定成立,成立的话,则将conf_data写到远程host的目录中 bootstrapped.add(hostname) LOG.debug('deploying rgw bootstrap to %s', hostname) distro.conn.remote_module.write_conf( args.cluster, conf_data, args.overwrite_conf, ) path = '/var/lib/ceph/bootstrap-rgw/{cluster}.keyring'.format( cluster=args.cluster, ) if not distro.conn.remote_module.path_exists(path): #远程host上不存在path的话,则将key写入远程host的path目录中 rlogger.warning('rgw keyring does not exist yet, creating one') distro.conn.remote_module.write_keyring(path, key) #启动ceph-radosg和ceph.target create_rgw(distro, name, args.cluster, distro.init) distro.conn.exit() LOG.info( ('The Ceph Object Gateway (RGW) is now running on host %s and ' 'default port %s'), hostname, '7480' ) except RuntimeError as e: LOG.error(e) errors += 1 if errors: raise exc.GenericError('Failed to create %d RGWs' % errors) def create_rgw(distro, name, cluster, init): conn = distro.conn conn.remote_module.touch_file(os.path.join(path, 'done')) conn.remote_module.touch_file(os.path.join(path, init)) #这里是通过romoto命令来在远程host上启动ceph-radosg和ceph.target elif init == 'systemd': remoto.process.run( conn, [ 'systemctl', 'enable', 'ceph-radosgw@{name}'.format(name=name), ], timeout=7 ) remoto.process.run( conn, [ 'systemctl', 'start', 'ceph-radosgw@{name}'.format(name=name), ], timeout=7 ) remoto.process.run( conn, [ 'systemctl', 'enable', 'ceph.target', ], timeout=7 )
相关文章推荐
- 使用ceph-deploy部署ceph命令解析
- ceph-deploy mon create-initial 命令
- ceph-deploy mon create命令
- ceph-deploy的admin 命令
- ceph-deploy gatherkeys命令
- ceph-deploy的calamari命令
- ceph-deploy的pkg命令
- CEPH RGW集群和bucket的zone group 不一致导致的404异常解决 及 使用radosgw-admin metadata 命令设置bucket metadata 的方法
- 【Ceph】ceph-deploy命令详解
- 使用ceph-deploy安装Ceph 12.x(一) 创建虚拟机环境
- 查看,修改ceph节点的ceph配置命令
- connecting to host: cephm resulted in errors: IOError cannot send (already closed?)[ceph-deploy部署报错]
- Ceph rgw CephContext的属性_service_thread
- ceph-deploy osd activate激活OSD报错
- ceph cluster添加/删除mon节点(ceph-deploy)
- ceph-monmap 命令处理流程
- Ceph RGW服务 使用s3 java sdk 分片文件上传API 报‘SignatureDoesNotMatch’ 异常的定位及规避方案
- Maven学习六之利用mvn deploy命令上传包
- 使用ceoh-deploy工具快速部署ceph--先决条件准备
- 使用ceph-deploy安装Ceph 12.x(三) 安装Ceph集群