Skip to content

Commit 56647ec

Browse files
authored
Merge pull request #275 from dmwm/revert-260-change_rucio_dm_mon_mongodb
Revert "Change rucio dm mon mongodb import configs"
2 parents 81378d8 + 2bc919a commit 56647ec

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

rucio-dataset-monitoring/spark/cron4rucio_hdfs2mongo.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ set -e
1212
##H - keytab : Kerberos auth file to connect Spark Analytix cluster (cmsmonit)
1313
##H - hdfs : HDFS_PATH output path that include spark job results. Mongoimport will import them.
1414
##H - mongohost : MongoDB host
15+
##H - mongoport : MongoDB port
1516
##H - mongouser : MongoDB user which has write access to required MongoDB database/collection
1617
##H - mongopass : MongoDB user password
1718
##H - mongowritedb : MongoDB database name that results will be written
1819
##H - mongoauthdb : MongoDB database for authentication. Required for mongoimport `--authenticationDatabase` argument
1920
##H - wdir : working directory
2021
##H
2122
##H Usage Example:
22-
##H ./cron4rucio_hdfs2mongo.sh --keytab ./keytab --hdfs /tmp/cmsmonit --mongohost $MONGO_HOST \
23-
##H --mongouser $MONGO_ROOT_USERNAME --mongopass $MONGO_ROOT_PASSWORD --mongowritedb rucio \
24-
##H --mongoauthdb admin --wdir $WDIR
23+
##H ./cron4rucio_hdfs2mongo.sh --keytab ./keytab --hdfs /tmp/cmsmonit --mongohost $MONGO_HOST --mongoport $MONGO_PORT \
24+
##H --mongouser $MONGO_ROOT_USERNAME --mongopass $MONGO_ROOT_PASSWORD --mongowritedb rucio --mongoauthdb admin --wdir $WDIR
2525
##H
2626
##H How to test:
2727
##H - You can test just by giving different '--mongowritedb'.
@@ -51,12 +51,12 @@ if [ "$1" == "" ] || [ "$1" == "-h" ] || [ "$1" == "--help" ] || [ "$1" == "-hel
5151
exit 0
5252
fi
5353
util_cron_send_start "$myname" "1d"
54-
unset -v KEYTAB_SECRET HDFS_PATH ARG_MONGOHOST ARG_MONGOUSER ARG_MONGOPASS ARG_MONGOWRITEDB ARG_MONGOAUTHDB WDIR help
54+
unset -v KEYTAB_SECRET HDFS_PATH ARG_MONGOHOST ARG_MONGOPORT ARG_MONGOUSER ARG_MONGOPASS ARG_MONGOWRITEDB ARG_MONGOAUTHDB WDIR help
5555
# ------------------------------------------------------------------------------------------------------------- PREPARE
5656
util4datasetmon_input_args_parser $@
5757

58-
util4logi "Parameters: KEYTAB_SECRET:${KEYTAB_SECRET} HDFS_PATH:${HDFS_PATH} ARG_MONGOHOST:${ARG_MONGOHOST} ARG_MONGOUSER:${ARG_MONGOUSER} ARG_MONGOWRITEDB:${ARG_MONGOWRITEDB} ARG_MONGOAUTHDB:${ARG_MONGOAUTHDB} WDIR:${WDIR}"
59-
util_check_vars HDFS_PATH ARG_MONGOHOST ARG_MONGOUSER ARG_MONGOPASS ARG_MONGOWRITEDB ARG_MONGOAUTHDB WDIR
58+
util4logi "Parameters: KEYTAB_SECRET:${KEYTAB_SECRET} HDFS_PATH:${HDFS_PATH} ARG_MONGOHOST:${ARG_MONGOHOST} ARG_MONGOPORT:${ARG_MONGOPORT} ARG_MONGOUSER:${ARG_MONGOUSER} ARG_MONGOWRITEDB:${ARG_MONGOWRITEDB} ARG_MONGOAUTHDB:${ARG_MONGOAUTHDB} WDIR:${WDIR}"
59+
util_check_vars HDFS_PATH ARG_MONGOHOST ARG_MONGOPORT ARG_MONGOUSER ARG_MONGOPASS ARG_MONGOWRITEDB ARG_MONGOAUTHDB WDIR
6060
util_setup_spark_k8s
6161

6262
# Check commands/CLIs exist
@@ -83,7 +83,7 @@ function run_mongo_import() {
8383
hadoop fs -getmerge "$hdfs_out_dir"/part-*.json "$local_json_merge_file"
8484

8585
mongoimport --drop --type=json \
86-
--host "$ARG_MONGOHOST" --username "$ARG_MONGOUSER" --password "$ARG_MONGOPASS" \
86+
--host "$ARG_MONGOHOST" --port "$ARG_MONGOPORT" --username "$ARG_MONGOUSER" --password "$ARG_MONGOPASS" \
8787
--authenticationDatabase "$ARG_MONGOAUTHDB" --db "$ARG_MONGOWRITEDB" \
8888
--collection "$collection" --file "$local_json_merge_file"
8989
util4logi "Mongoimport finished. ${hdfs_out_dir} imported to collection: ${collection}"
@@ -105,7 +105,7 @@ run_mongo_import "${HDFS_PATH}/${hdfs_datasets_in_tape_and_disk}" "$col_datasets
105105
# Write current date to json file and import it to MongoDB "source_timestamp" collection for Go Web Page.
106106
echo "{\"createdAt\": \"$(date +%Y-%m-%d)\"}" >source_timestamp.json
107107
mongoimport --drop --type=json \
108-
--host "$ARG_MONGOHOST" --username "$ARG_MONGOUSER" --password "$ARG_MONGOPASS" \
108+
--host "$ARG_MONGOHOST" --port "$ARG_MONGOPORT" --username "$ARG_MONGOUSER" --password "$ARG_MONGOPASS" \
109109
--authenticationDatabase "$ARG_MONGOAUTHDB" --db "$ARG_MONGOWRITEDB" \
110110
--collection "source_timestamp" --file source_timestamp.json
111111

@@ -115,7 +115,7 @@ util4logi "source_timestamp collection is updated with current date"
115115
# Modify JS script
116116
sed -i "s/_MONGOWRITEDB_/$ARG_MONGOWRITEDB/g" "$script_dir"/createindexes.js
117117

118-
mongosh --host "$ARG_MONGOHOST" --username "$ARG_MONGOUSER" --password "$ARG_MONGOPASS" \
118+
mongosh --host "$ARG_MONGOHOST" --port "$ARG_MONGOPORT" --username "$ARG_MONGOUSER" --password "$ARG_MONGOPASS" \
119119
--authenticationDatabase "$ARG_MONGOAUTHDB" <"$script_dir"/createindexes.js
120120
util4logi "MongoDB indexes are created for datasets and detailed_datasets collections"
121121

0 commit comments

Comments
 (0)