• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python conductor.cluster_update函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sahara.conductor.cluster_update函数的典型用法代码示例。如果您正苦于以下问题:Python cluster_update函数的具体用法?Python cluster_update怎么用?Python cluster_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cluster_update函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _prepare_ranger

def _prepare_ranger(cluster):
    ranger = plugin_utils.get_instance(cluster, p_common.RANGER_ADMIN)
    if not ranger:
        return
    ambari = plugin_utils.get_instance(cluster, p_common.AMBARI_SERVER)
    with ambari.remote() as r:
        sudo = functools.partial(r.execute_command, run_as_root=True)
        sudo("yum install -y mysql-connector-java")
        sudo("ambari-server setup --jdbc-db=mysql "
             "--jdbc-driver=/usr/share/java/mysql-connector-java.jar")
    init_db_template = (
        "create user 'root'@'%' identified by '{password}';\n"
        "set password for 'root'@'localhost' = password('{password}');")
    password = uuidutils.generate_uuid()
    extra = cluster.extra.to_dict() if cluster.extra else {}
    extra["ranger_db_password"] = password
    ctx = context.ctx()
    conductor.cluster_update(ctx, cluster, {"extra": extra})
    with ranger.remote() as r:
        sudo = functools.partial(r.execute_command, run_as_root=True)
        # TODO(sreshetnyak): add ubuntu support
        sudo("yum install -y mysql-server")
        sudo("service mysqld start")
        r.write_file_to("/tmp/init.sql",
                        init_db_template.format(password=password))
        sudo("mysql < /tmp/init.sql")
        sudo("rm /tmp/init.sql")
开发者ID:Imperat,项目名称:sahara,代码行数:27,代码来源:deploy.py


示例2: _set_cluster_info

    def _set_cluster_info(self, cluster):
        nn = vu.get_namenode(cluster)
        rm = vu.get_resourcemanager(cluster)
        hs = vu.get_historyserver(cluster)
        oo = vu.get_oozie(cluster)

        info = {}

        if rm:
            info['YARN'] = {
                'Web UI': 'http://%s:%s' % (rm.management_ip, '8088'),
                'ResourceManager': 'http://%s:%s' % (rm.management_ip, '8032')
            }

        if nn:
            info['HDFS'] = {
                'Web UI': 'http://%s:%s' % (nn.management_ip, '50070'),
                'NameNode': 'hdfs://%s:%s' % (nn.hostname(), '9000')
            }

        if oo:
            info['JobFlow'] = {
                'Oozie': 'http://%s:%s' % (oo.management_ip, '11000')
            }

        if hs:
            info['MapReduce JobHistory Server'] = {
                'Web UI': 'http://%s:%s' % (hs.management_ip, '19888')
            }

        ctx = context.ctx()
        conductor.cluster_update(ctx, cluster, {'info': info})
开发者ID:AlexanderYAPPO,项目名称:sahara,代码行数:32,代码来源:versionhandler.py


示例3: _set_cluster_info

    def _set_cluster_info(self, cluster):
        nn = vu.get_namenode(cluster)
        jt = vu.get_jobtracker(cluster)
        oozie = vu.get_oozie(cluster)
        info = {}

        if jt:
            ui_port = c_helper.get_port_from_config("MapReduce", "mapred.job.tracker.http.address", cluster)
            jt_port = c_helper.get_port_from_config("MapReduce", "mapred.job.tracker", cluster)

            info["MapReduce"] = {
                "Web UI": "http://%s:%s" % (jt.management_ip, ui_port),
                "JobTracker": "%s:%s" % (jt.hostname(), jt_port),
            }

        if nn:
            ui_port = c_helper.get_port_from_config("HDFS", "dfs.http.address", cluster)
            nn_port = c_helper.get_port_from_config("HDFS", "fs.default.name", cluster)

            info["HDFS"] = {
                "Web UI": "http://%s:%s" % (nn.management_ip, ui_port),
                "NameNode": "hdfs://%s:%s" % (nn.hostname(), nn_port),
            }

        if oozie:
            # TODO(yrunts) change from hardcode value
            info["JobFlow"] = {"Oozie": "http://%s:11000" % oozie.management_ip}

        ctx = context.ctx()
        conductor.cluster_update(ctx, cluster, {"info": info})
开发者ID:metasensus,项目名称:sahara,代码行数:30,代码来源:versionhandler.py


示例4: _set_cluster_info

    def _set_cluster_info(self, cluster, cluster_spec):
        info = {}
        for service in cluster_spec.services:
            if service.deployed:
                service.register_service_urls(cluster_spec, info)

        conductor.cluster_update(context.ctx(), cluster, {'info': info})
开发者ID:JohannaMW,项目名称:sahara,代码行数:7,代码来源:ambariplugin.py


示例5: _set_cluster_info

    def _set_cluster_info(self, cluster):
        nn = vu.get_namenode(cluster)
        rm = vu.get_resourcemanager(cluster)
        hs = vu.get_historyserver(cluster)
        oo = vu.get_oozie(cluster)

        info = {}

        if rm:
            info["YARN"] = {
                "Web UI": "http://%s:%s" % (rm.management_ip, "8088"),
                "ResourceManager": "http://%s:%s" % (rm.management_ip, "8032"),
            }

        if nn:
            info["HDFS"] = {
                "Web UI": "http://%s:%s" % (nn.management_ip, "50070"),
                "NameNode": "hdfs://%s:%s" % (nn.hostname(), "9000"),
            }

        if oo:
            info["JobFlow"] = {"Oozie": "http://%s:%s" % (oo.management_ip, "11000")}

        if hs:
            info["MapReduce JobHistory Server"] = {"Web UI": "http://%s:%s" % (hs.management_ip, "19888")}

        ctx = context.ctx()
        conductor.cluster_update(ctx, cluster, {"info": info})
开发者ID:B-Rich,项目名称:sahara,代码行数:28,代码来源:versionhandler.py


示例6: _set_cluster_info

    def _set_cluster_info(self, cluster):
        mng = u.get_instances(cluster, 'manager')[0]
        nn = u.get_namenode(cluster)
        jt = u.get_jobtracker(cluster)
        oozie = u.get_oozie(cluster)

        #TODO(alazarev) make port configurable (bug #1262895)
        info = {'IDH Manager': {
            'Web UI': 'https://%s:9443' % mng.management_ip
        }}

        if jt:
            #TODO(alazarev) make port configurable (bug #1262895)
            info['MapReduce'] = {
                'Web UI': 'http://%s:50030' % jt.management_ip
            }
            #TODO(alazarev) make port configurable (bug #1262895)
            info['MapReduce']['JobTracker'] = '%s:54311' % jt.hostname()
        if nn:
            #TODO(alazarev) make port configurable (bug #1262895)
            info['HDFS'] = {
                'Web UI': 'http://%s:50070' % nn.management_ip
            }
            #TODO(alazarev) make port configurable (bug #1262895)
            info['HDFS']['NameNode'] = 'hdfs://%s:8020' % nn.hostname()

        if oozie:
            #TODO(alazarev) make port configurable (bug #1262895)
            info['JobFlow'] = {
                'Oozie': 'http://%s:11000' % oozie.management_ip
            }

        ctx = context.ctx()
        conductor.cluster_update(ctx, cluster, {'info': info})
开发者ID:qinweiwei,项目名称:sahara,代码行数:34,代码来源:versionhandler.py


示例7: _generate_hive_mysql_password

 def _generate_hive_mysql_password(self, cluster):
     extra = cluster.extra.to_dict() if cluster.extra else {}
     password = extra.get("hive_mysql_passwd")
     if not password:
         password = six.text_type(uuid.uuid4())
         extra["hive_mysql_passwd"] = password
         conductor.cluster_update(context.ctx(), cluster, {"extra": extra})
     return password
开发者ID:metasensus,项目名称:sahara,代码行数:8,代码来源:versionhandler.py


示例8: _set_cluster_info

    def _set_cluster_info(self, cluster):
        info = CU.get_cloudera_manager_info(cluster)
        hue = CU.pu.get_hue(cluster)
        if hue:
            info['Hue Dashboard'] = {
                'Web UI': 'http://%s:8888' % hue.management_ip
            }

        ctx = context.ctx()
        conductor.cluster_update(ctx, cluster, {'info': info})
开发者ID:crobby,项目名称:sahara,代码行数:10,代码来源:versionhandler.py


示例9: update_default_ambari_password

def update_default_ambari_password(cluster):
    ambari = plugin_utils.get_instance(cluster, p_common.AMBARI_SERVER)
    new_password = uuidutils.generate_uuid()
    with ambari_client.AmbariClient(ambari) as client:
        client.update_user_password("admin", "admin", new_password)
    extra = cluster.extra.to_dict() if cluster.extra else {}
    extra["ambari_password"] = new_password
    ctx = context.ctx()
    conductor.cluster_update(ctx, cluster, {"extra": extra})
    cluster = conductor.cluster_get(ctx, cluster.id)
开发者ID:Imperat,项目名称:sahara,代码行数:10,代码来源:deploy.py


示例10: _set_cluster_info

    def _set_cluster_info(self, cluster):
        st_master = utils.get_instance(cluster, "nimbus")
        info = {}

        if st_master:
            port = "8080"

            info["Strom"] = {"Web UI": "http://%s:%s" % (st_master.management_ip, port)}
        ctx = context.ctx()
        conductor.cluster_update(ctx, cluster, {"info": info})
开发者ID:egafford,项目名称:sahara,代码行数:10,代码来源:plugin.py


示例11: _set_cluster_info

    def _set_cluster_info(self, cluster):
        st_master = utils.get_instance(cluster, "nimbus")
        info = {}

        if st_master:
            port = "8080"

            info['Strom'] = {
                'Web UI': 'http://%s:%s' % (st_master.management_ip, port)
            }
        ctx = context.ctx()
        conductor.cluster_update(ctx, cluster, {'info': info})
开发者ID:frgaudet,项目名称:sahara,代码行数:12,代码来源:plugin.py


示例12: _set_cluster_info

    def _set_cluster_info(self, cluster):
        mng = cu.get_manager(cluster)
        info = {
            'Cloudera Manager': {
                'Web UI': 'http://%s:7180' % mng.management_ip,
                'Username': 'admin',
                'Password': 'admin'
            }
        }

        ctx = context.ctx()
        conductor.cluster_update(ctx, cluster, {'info': info})
开发者ID:a9261,项目名称:sahara,代码行数:12,代码来源:plugin.py


示例13: _update_cluster_info

    def _update_cluster_info(self, cluster_context):
        LOG.debug('Updating UI information.')
        info = dict()
        for service in cluster_context.cluster_services:
            for uri_info in service.ui_info:
                title, process, url = uri_info
                info.update({
                    title: {
                        'WebUI': url % cluster_context.get_instance_ip(process)
                    }
                })

        ctx = context.ctx()
        conductor.cluster_update(ctx, cluster_context.cluster, {'info': info})
开发者ID:YongchaoTIAN,项目名称:sahara,代码行数:14,代码来源:base_cluster_configurer.py


示例14: _set_cluster_info

 def _set_cluster_info(self, cluster):
     ambari_ip = plugin_utils.get_instance(cluster, p_common.AMBARI_SERVER).management_ip
     ambari_port = "8080"
     info = {
         p_common.AMBARI_SERVER: {
             "Web UI": "http://{host}:{port}".format(host=ambari_ip, port=ambari_port),
             "Username": "admin",
             "Password": cluster.extra["ambari_password"],
         }
     }
     namenode = plugin_utils.get_instance(cluster, p_common.NAMENODE)
     if namenode:
         info[p_common.NAMENODE] = {"Web UI": "http://%s:50070" % namenode.management_ip}
     resourcemanager = plugin_utils.get_instance(cluster, p_common.RESOURCEMANAGER)
     if resourcemanager:
         info[p_common.RESOURCEMANAGER] = {"Web UI": "http://%s:8088" % resourcemanager.management_ip}
     historyserver = plugin_utils.get_instance(cluster, p_common.HISTORYSERVER)
     if historyserver:
         info[p_common.HISTORYSERVER] = {"Web UI": "http://%s:19888" % historyserver.management_ip}
     atlserver = plugin_utils.get_instance(cluster, p_common.APP_TIMELINE_SERVER)
     if atlserver:
         info[p_common.APP_TIMELINE_SERVER] = {"Web UI": "http://%s:8188" % atlserver.management_ip}
     oozie = plugin_utils.get_instance(cluster, p_common.OOZIE_SERVER)
     if oozie:
         info[p_common.OOZIE_SERVER] = {"Web UI": "http://%s:11000/oozie" % oozie.management_ip}
     hbase_master = plugin_utils.get_instance(cluster, p_common.HBASE_MASTER)
     if hbase_master:
         info[p_common.HBASE_MASTER] = {"Web UI": "http://%s:60010" % hbase_master.management_ip}
     falcon = plugin_utils.get_instance(cluster, p_common.FALCON_SERVER)
     if falcon:
         info[p_common.FALCON_SERVER] = {"Web UI": "http://%s:15000" % falcon.management_ip}
     storm_ui = plugin_utils.get_instance(cluster, p_common.STORM_UI_SERVER)
     if storm_ui:
         info[p_common.STORM_UI_SERVER] = {"Web UI": "http://%s:8744" % storm_ui.management_ip}
     ranger_admin = plugin_utils.get_instance(cluster, p_common.RANGER_ADMIN)
     if ranger_admin:
         info[p_common.RANGER_ADMIN] = {
             "Web UI": "http://%s:6080" % ranger_admin.management_ip,
             "Username": "admin",
             "Password": "admin",
         }
     spark_hs = plugin_utils.get_instance(cluster, p_common.SPARK_JOBHISTORYSERVER)
     if spark_hs:
         info[p_common.SPARK_JOBHISTORYSERVER] = {"Web UI": "http://%s:18080" % spark_hs.management_ip}
     info.update(cluster.info.to_dict())
     ctx = context.ctx()
     conductor.cluster_update(ctx, cluster, {"info": info})
     cluster = conductor.cluster_get(ctx, cluster.id)
开发者ID:rogeryu27,项目名称:sahara,代码行数:48,代码来源:plugin.py


示例15: create_hadoop_ssh_keys

def create_hadoop_ssh_keys(cluster):
    private_key, public_key = crypto.generate_key_pair()
    extra = {
        'hadoop_private_ssh_key': private_key,
        'hadoop_public_ssh_key': public_key
    }
    return conductor.cluster_update(context.ctx(), cluster, {'extra': extra})
开发者ID:qinweiwei,项目名称:sahara,代码行数:7,代码来源:installer.py


示例16: _set_cluster_info

    def _set_cluster_info(self, cluster):
        mng = CU.pu.get_manager(cluster)
        info = {
            'Cloudera Manager': {
                'Web UI': 'http://%s:7180' % mng.management_ip,
                'Username': 'admin',
                'Password': db_helper.get_cm_password(cluster)
            }
        }
        hue = CU.pu.get_hue(cluster)
        if hue:
            info['Hue Dashboard'] = {
                'Web UI': 'http://%s:8888' % hue.management_ip
            }

        ctx = context.ctx()
        conductor.cluster_update(ctx, cluster, {'info': info})
开发者ID:rsaha,项目名称:sahara,代码行数:17,代码来源:versionhandler.py


示例17: _set_cluster_info

    def _set_cluster_info(self, cluster):
        nn = utils.get_instance(cluster, "namenode")
        sp_master = utils.get_instance(cluster, "master")
        info = {}

        if nn:
            address = c_helper.get_config_value("HDFS", "dfs.http.address", cluster)
            port = address[address.rfind(":") + 1 :]
            info["HDFS"] = {"Web UI": "http://%s:%s" % (nn.management_ip, port)}
            info["HDFS"]["NameNode"] = "hdfs://%s:8020" % nn.hostname()

        if sp_master:
            port = c_helper.get_config_value("Spark", "Master webui port", cluster)
            if port is not None:
                info["Spark"] = {"Web UI": "http://%s:%s" % (sp_master.management_ip, port)}
        ctx = context.ctx()
        conductor.cluster_update(ctx, cluster, {"info": info})
开发者ID:hao707822882,项目名称:sahara,代码行数:17,代码来源:plugin.py


示例18: get_password_from_db

def get_password_from_db(cluster, pwname):
    ctx = context.ctx()
    cluster = conductor.cluster_get(ctx, cluster.id)
    passwd = cluster.extra.get(pwname) if cluster.extra else None
    if passwd:
        return passwd

    passwd = six.text_type(uuid.uuid4())
    extra = cluster.extra.to_dict() if cluster.extra else {}
    extra[pwname] = passwd
    cluster = conductor.cluster_update(ctx, cluster, {'extra': extra})
    return passwd
开发者ID:AlexanderYAPPO,项目名称:sahara,代码行数:12,代码来源:db_helper.py


示例19: get_sentry_db_password

def get_sentry_db_password(cluster):
    ctx = context.ctx()
    cluster = conductor.cluster_get(ctx, cluster.id)
    passwd = cluster.extra.get('sentry_db_password') if cluster.extra else None
    if passwd:
        return passwd

    passwd = six.text_type(uuid.uuid4())
    extra = cluster.extra.to_dict() if cluster.extra else {}
    extra['sentry_db_password'] = passwd
    cluster = conductor.cluster_update(ctx, cluster, {'extra': extra})
    return passwd
开发者ID:AllenFromMinneapolis,项目名称:sahara,代码行数:12,代码来源:db_helper.py


示例20: _update_cluster_info

    def _update_cluster_info(self, cluster_context):
        LOG.debug('Updating UI information.')
        info = {}
        for service in cluster_context.cluster_services:
            for title, node_process, url_template in service.ui_info:
                removed = cluster_context.removed_instances(node_process)
                instances = cluster_context.get_instances(node_process)
                instances = [i for i in instances if i not in removed]

                if len(instances) == 1:
                    display_name_template = "%(title)s"
                else:
                    display_name_template = "%(title)s %(index)s"

                for index, instance in enumerate(instances, start=1):
                    args = {"title": title, "index": index}
                    display_name = display_name_template % args
                    url = url_template % instance.management_ip
                    info.update({display_name: {"WebUI": url}})

        ctx = context.ctx()
        conductor.cluster_update(ctx, cluster_context.cluster, {'info': info})
开发者ID:frgaudet,项目名称:sahara,代码行数:22,代码来源:base_cluster_configurer.py



注:本文中的sahara.conductor.cluster_update函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python context.ctx函数代码示例发布时间:2022-05-27
下一篇:
Python misc.encode_response函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap