在 emr 上重启 hiveserver2

Restart hiveserver2 on emr

我在我的 EMR 集群上杀死了 hiveserver2 进程(在找到带有 ps aux|grep -i hiveserver2 的 PID 之后),其中有一个主节点和两个工作节点。在杀死 hiveserver2 之前,我能够通过 HUE 在我的浏览器上浏览和查询 Hive。我尝试用 hive --service hiveserver2 重新启动,但后来我无法再从 HUE 连接,它要么挂起,要么说它无法连接到 <publicDNS>:10000

我的用例是我想在不关闭集群的情况下修改我的 EMR 集群的配置单元配置。这可能吗?

可以在启动集群之前添加 Hive 配置,而不是在集群准备就绪之后。您可以在 bootstrap 步骤中将它们添加为配置设置。

您可以使用以下语法(在 java 中)在 hive-site.xml 中添加配置:

    Map<String,String> hiveProperties = new HashMap<String,String>();
    hiveProperties.put("hive.vectorized.execution.enabled","true");
    hiveProperties.put("hive.vectorized.execution.reduce.enabled","true");
    hiveProperties.put("hive.execution.engine","Tez");
    hiveProperties.put("hive.auto.convert.join","true");
    hiveProperties.put("hive.exec.parallel","true");

    Configuration myHiveConfig = new Configuration()
    .withClassification("hive-site")
    .withProperties(hiveProperties);

    List <Application> apps = new ArrayList<Application>();
    apps.add(new Application().withName("Hadoop"));
    apps.add(new Application().withName("Hive"));
    apps.add(new Application().withName("Spark"));
    //apps.add(new Application().withName("Pig"));
    //apps.add(new Application().withName("Zeppelin-Sandbox"));

    RunJobFlowRequest request = new RunJobFlowRequest()
    .withName("abc")
        .withReleaseLabel(emrVersion) //"emr-4.3.0"
    .withServiceRole("EMR_DefaultRole")
    .withConfigurations(myHiveConfig)
        .withInstances(
                  new JobFlowInstancesConfig()
                        .withInstanceCount(numberofInstances)
                        .withKeepJobFlowAliveWhenNoSteps(true)
                        .withTerminationProtected(false)
                        .withMasterInstanceType(mserverType)
                        .withSlaveInstanceType(sserverType) 
                  )
    .withApplications(apps)
    .withJobFlowRole("EMR_EC2_DefaultRole")
    .withSteps(generalSteps);

下面 link 中有更多详细信息:

http://docs.aws.amazon.com/ElasticMapReduce/latest/ReleaseGuide/emr-configure-apps.html

initctl list
status hive-server2

sudo restart hive-server2
sudo stop hive-server2
sudo start hive-server2

How do I restart a service in Amazon EMR?