Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new scripts of sharding #41

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
247 changes: 136 additions & 111 deletions docker-based-sharding-deployment/README.md

Large diffs are not rendered by default.

70 changes: 59 additions & 11 deletions docker-based-sharding-deployment/dockerfiles/19.3.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -18,19 +18,30 @@
#
# Pull base image
# ---------------
FROM oraclelinux:7-slim as base
ARG BASE_OL_IMAGE=oraclelinux:7-slim

# Maintainer
# ----------
MAINTAINER Paramdeep Saini <paramdeep.saini@oracle.com>
# Pull base image
# ---------------
FROM $BASE_OL_IMAGE AS base

# Labels
# ------
LABEL "provider"="Oracle" \
"issues"="https://github.com/oracle/db-sharding/issues" \
"volume.setup.location1"="/opt/oracle/scripts" \
"port.listener"="1522"

# Argument to control removal of components not needed after db software installation
ARG SLIMMING=false
ARG INSTALL_FILE_1="LINUX.X64_193000_gsm.zip"

# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV GSM_BASE="/u01/app/oracle" \
GSM_HOME="/u01/app/oracle/product/19c/gsmhome_1" \
INVENTORY="/u01/app/oracle/oraInventory" \
INSTALL_DIR="/opt/oracle/scripts" \
INSTALL_FILE_1="LINUX.X64_193000_gsm.zip" \
INSTALL_FILE_1=$INSTALL_FILE_1 \
INSTALL_RSP="19c_gsm_install.rsp" \
RUN_FILE="runOracle.sh" \
SETUP_LINUX_FILE="setupLinuxEnv.sh" \
@@ -41,20 +52,22 @@ ENV GSM_BASE="/u01/app/oracle" \
GSM_ENV_SETUP_FILE="setupGSM.sh" \
GSM_SCRIPTS="scripts" \
MAINPY="main.py" \
CHECKLIVENESS="checkLiveness.sh"
PYTHON_FILE="/usr/bin/python" \
PYTHON3_FILE="/usr/bin/python3" \
CHECKLIVENESS="checkLiveness.sh"
# Use second ENV so that variable get substituted
ENV INSTALL_SCRIPTS=$INSTALL_DIR/install \
ORACLE_HOME=$GSM_HOME \
ORACLE_BASE=$GSM_BASE \
SCRIPT_DIR=$INSTALL_DIR/sharding \
PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH \
GSM_PATH=$GSM_HOME/bin:/usr/sbin:$PATH \
GSM_LD_LIBRARY_PATH=$GSM_HOME/lib:/usr/lib:/lib
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
GSM_PATH=$GSM_HOME/bin:$PATH \
GSM_LD_LIBRARY_PATH=$GSM_HOME/lib:/usr/lib:/lib


# Copy files needed during both installation and runtime
# ------------
COPY $INSTALL_FILE_1 $SETUP_LINUX_FILE $CHECK_SPACE_FILE $INSTALL_RSP $GSM_ENV_SETUP_FILE $INSTALL_GSM_BINARIES_FILE $GSM_SETUP_FILE $INSTALL_DIR/install/
COPY $SETUP_LINUX_FILE $CHECK_SPACE_FILE $GSM_ENV_SETUP_FILE $INSTALL_DIR/install/
COPY $RUN_FILE $GSM_SETUP_FILE $CHECKLIVENESS $USER_SCRIPTS_FILE $SCRIPT_DIR/
COPY $GSM_SCRIPTS $SCRIPT_DIR/scripts/

@@ -63,7 +76,22 @@ RUN chmod 755 $INSTALL_DIR/install/*.sh && \
$INSTALL_DIR/install/$CHECK_SPACE_FILE && \
$INSTALL_DIR/install/$SETUP_LINUX_FILE && \
$INSTALL_DIR/install/$GSM_ENV_SETUP_FILE && \
sync

#############################################
# -------------------------------------------
# Start new stage for installing the GSM
# -------------------------------------------
#############################################

from base AS builder

COPY $INSTALL_FILE_1 $INSTALL_RSP $INSTALL_GSM_BINARIES_FILE $GSM_SETUP_FILE $INSTALL_DIR/install/

RUN chmod 755 $INSTALL_SCRIPTS/*.sh && \
sync && \
sed -e '/hard *memlock/s/^/#/g' -i /etc/security/limits.d/oracle-database-preinstall-19c.conf && \
sed -e '/ *nofile /s/^/#/g' -i /etc/security/limits.d/oracle-database-preinstall-19c.conf && \
su oracle -c "$INSTALL_DIR/install/$INSTALL_GSM_BINARIES_FILE" && \
$INVENTORY/orainstRoot.sh && \
$GSM_HOME/root.sh && \
@@ -72,10 +100,30 @@ RUN chmod 755 $INSTALL_DIR/install/*.sh && \
rm -f /etc/sysctl.d/99-sysctl.conf && \
rm -f /etc/rc.d/init.d/oracle-database-preinstall-19c-firstboot && \
rm -f /etc/security/limits.d/oracle-database-preinstall-19c.conf && \
sync

#############################################
# -------------------------------------------
# Start new layer for GSM runtime
# -------------------------------------------
#############################################

FROM base

COPY --from=builder /u01 /u01

RUN if [ ! -f $PYTHON_FILE ]; then \
ln -s $PYTHON3_FILE $PYTHON_FILE && \
:; \
fi && \
rm -f $INSTALL_DIR/install/* && \
cp $SCRIPT_DIR/scripts/cmdExec $SCRIPT_DIR/ && \
chown -R oracle:oinstall $SCRIPT_DIR && \
chmod 755 $SCRIPT_DIR/*.sh && \
chmod 755 $SCRIPT_DIR/scripts/*.py && \
chmod 755 $SCRIPT_DIR/scripts/*.sh && \
chmod 755 $SCRIPT_DIR/scripts/cmdExec && \
chmod 755 $SCRIPT_DIR/cmdExec && \
sync

USER oracle
Empty file.
Empty file.
29 changes: 25 additions & 4 deletions docker-based-sharding-deployment/dockerfiles/19.3.0/scripts/main.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ def main():

# Checking Comand line Args
try:
opts, args = getopt.getopt(sys.argv[1:], '', ['addshard=','deleteshard=','validateshard=','checkliveness=','resetlistener=','restartdb=','createdir=','optype=','addshardgroup=','deployshard=','movechunks=','checkonlineshard=','cancelchunks=','checkchunks=','checkgsmshard=','validatenochunks=','invitednode=','help'])
opts, args = getopt.getopt(sys.argv[1:], '', ['addshard=','deleteshard=','validateshard=','checkliveness=','resetlistener=','restartdb=','createdir=','optype=','addshardgroup=','deployshard=','movechunks=','checkonlineshard=','cancelchunks=','checkchunks=','checkgsmshard=','checkreadyness=','validatenochunks=','invitednode=','resetpassword=','exporttdekey=','importtdekey=','help'])
except getopt.GetoptError:
pass

@@ -45,7 +45,7 @@ def main():

for opt, arg in opts:
if opt in ('--help'):
oralogger.msg_ = '''{:^17}-{:^17} : You can pass parameter --addshard, --deleteshard, --validateshard, --checkliveness, --resetlistener, --restartdb, --createdir, --optype, --addshardgroup, --deployshard, '--checkonlineshard', '--cancelchunks', '--movechunks', '--checkchunks', '--checkgsmshard','--validatenochunks', '--invitednode', or --help'''
oralogger.msg_ = '''{:^17}-{:^17} : You can pass parameter --addshard, --deleteshard, --validateshard, --checkliveness, --resetlistener, --restartdb, --createdir, --optype, --addshardgroup, --deployshard, '--checkonlineshard', '--cancelchunks', '--movechunks', '--checkchunks', '--checkgsmshard','--validatenochunks', '--checkreadyness','--invitednode', '--resetpassword','--exporttdekey','--importtdekey',or --help'''
stdout_handler.handle(oralogger)
elif opt in ('--addshard'):
file_name = oenv.logfile_name("ADD_SHARD")
@@ -68,6 +68,12 @@ def main():
oralogger.filename_ = file_name
ocommon.log_info_message("=======================================================================",file_name)
oenv.add_custom_variable("CHECK_LIVENESS",arg)
elif opt in ('--checkreadyness'):
oralogger.stdout_ = None
file_name = oenv.logfile_name("CHECK_READYNESS")
oralogger.filename_ = file_name
ocommon.log_info_message("=======================================================================",file_name)
oenv.add_custom_variable("CHECK_READYNESS",arg)
elif opt in ('--resetlistener'):
file_name = oenv.logfile_name("RESET_LISTENER")
oralogger.filename_ = file_name
@@ -83,8 +89,6 @@ def main():
oralogger.filename_ = file_name
ocommon.log_info_message("=======================================================================",file_name)
oenv.add_custom_variable("CREATE_DIR",arg)
elif opt in ('--optype'):
oenv.add_custom_variable("OP_TYPE",arg)
elif opt in ('--addshardgroup'):
file_name = oenv.logfile_name("ADD_SGROUP_PARAMS")
oralogger.filename_ = file_name
@@ -130,6 +134,23 @@ def main():
oralogger.filename_ = file_name
ocommon.log_info_message("=======================================================================",file_name)
oenv.add_custom_variable("INVITED_NODE_OP",arg)
elif opt in ('--resetpassword'):
file_name = oenv.logfile_name("RESET_PASSWD")
oralogger.filename_ = file_name
ocommon.log_info_message("=======================================================================",file_name)
oenv.add_custom_variable("RESET_PASSWORD",arg)
elif opt in ('--exporttdekey'):
file_name = oenv.logfile_name("EXPORT_TDE_KEY")
oralogger.filename_ = file_name
ocommon.log_info_message("=======================================================================",file_name)
oenv.add_custom_variable("EXPORT_TDE_KEY",arg)
elif opt in ('--importtdekey'):
file_name = oenv.logfile_name("IMPORT_TDE_KEY")
oralogger.filename_ = file_name
ocommon.log_info_message("=======================================================================",file_name)
oenv.add_custom_variable("IMPORT_TDE_KEY",arg)
elif opt in ('--optype'):
oenv.add_custom_variable("OP_TYPE",arg)
else:
pass

Loading
Oops, something went wrong.