Skip to content

Commit

Permalink
first run
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterZh6 committed Oct 4, 2024
1 parent 851aa88 commit bf0b6e3
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@
<artifactId>jedis</artifactId>
<scope>test</scope>
</dependency>
<!-- <dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
</dependency> -->
<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-core</artifactId>
<version>5.2.0</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ public HBaseContainer(String imageName) {

public String getDriverClassName() {
try {
Class.forName("org.apache.hbase.jdbc.Driver");
return "org.apache.hbase.jdbc.Driver";
Class.forName("com.mysql.cj.jdbc.Driver");
return "com.mysql.cj.jdbc.Driver";
} catch (ClassNotFoundException e) {
throw new RuntimeException("HBase JDBC Driver not found!", e);
return "com.mysql.jdbc.Driver";
// throw new RuntimeException("HBase JDBC Driver not found!", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ public class HBaseManager {
public static final String INTER_CONTAINER_HBASE_ALIAS = "hbase";
private static final String NEW_HBASE_REPOSITORY = "inlong-hbase";
private static final String NEW_HBASE_TAG = "latest";
private static final String HBASE_IMAGE_NAME = "harisekhon/hbase:2.4.11";
private static final String HBASE_IMAGE_NAME = "harisekhon/hbase:latest";
private static final String DEFAULT_COLUMN_FAMILY = "cf1";
public static final Logger HBASE_LOG = LoggerFactory.getLogger(HBaseContainer.class);

static {
GenericContainer oldHBase = new GenericContainer(HBASE_IMAGE_NAME);
Startables.deepStart(Stream.of(oldHBase)).join();
oldHBase.copyFileToContainer(MountableFile.forClasspathResource("/docker/hbase/start_hbase.sh"),
oldHBase.copyFileToContainer(MountableFile.forClasspathResource("/docker/hbase/start-hbase.sh"),
"/data/hbase/");
try {
oldHBase.execInContainer("chmod", "+x", "/data/hbase/start_hbase.sh");
oldHBase.execInContainer("chmod", "+x", "/data/hbase/start-hbase.sh");
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash
#
#/**
# * Licensed to the Apache Software Foundation (ASF) under one
# * or more contributor license agreements. See the NOTICE file
# * distributed with this work for additional information
# * regarding copyright ownership. The ASF licenses this file
# * to you under the Apache License, Version 2.0 (the
# * "License"); you may not use this file except in compliance
# * with the License. You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# */

# Modelled after $HADOOP_HOME/bin/start-hbase.sh.

# Start hadoop hbase daemons.
# Run this on master node.
usage="Usage: start-hbase.sh [--autostart-window-size <window size in hours>]\
[--autostart-window-retry-limit <retry count limit for autostart>]\
[autostart|start]"

bin=`dirname "${BASH_SOURCE-$0}"`
bin=`cd "$bin">/dev/null; pwd`

# default autostart args value indicating infinite window size and no retry limit
AUTOSTART_WINDOW_SIZE=0
AUTOSTART_WINDOW_RETRY_LIMIT=0

. "$bin"/hbase-config.sh

# start hbase daemons
errCode=$?
if [ $errCode -ne 0 ]
then
exit $errCode
fi

if [ "$1" = "autostart" ]
then
commandToRun="--autostart-window-size ${AUTOSTART_WINDOW_SIZE} --autostart-window-retry-limit ${AUTOSTART_WINDOW_RETRY_LIMIT} autostart"
else
commandToRun="start"
fi

# HBASE-6504 - only take the first line of the output in case verbose gc is on
distMode=`$bin/hbase --config "$HBASE_CONF_DIR" org.apache.hadoop.hbase.util.HBaseConfTool hbase.cluster.distributed | head -n 1`

if [ "$distMode" == 'false' ]
then
"$bin"/hbase-daemon.sh --config "${HBASE_CONF_DIR}" $commandToRun master
else
"$bin"/hbase-daemons.sh --config "${HBASE_CONF_DIR}" $commandToRun zookeeper
"$bin"/hbase-daemon.sh --config "${HBASE_CONF_DIR}" $commandToRun master
"$bin"/hbase-daemons.sh --config "${HBASE_CONF_DIR}" \
--hosts "${HBASE_REGIONSERVERS}" $commandToRun regionserver
"$bin"/hbase-daemons.sh --config "${HBASE_CONF_DIR}" \
--hosts "${HBASE_BACKUP_MASTERS}" $commandToRun master-backup
fi

0 comments on commit bf0b6e3

Please sign in to comment.