Skip to content

Commit

Permalink
Merge pull request #4 from sravotto/doc
Browse files Browse the repository at this point in the history
setup + minimal readme
  • Loading branch information
jpcs authored Mar 24, 2021
2 parents 6b01acf + 15a596e commit 20b50a0
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
** Query Plan Viewer

The Query Plan Viewer displays in a graphical interface optimization and diagnostic plans produced by the MarkLogic Optic and SPARQL engine.

** Setup

On the host where MarkLogic server is running, execute:

./setup.sh ---user=ADMIN_USER --pass=ADMIN_PASS --port=PORT

It will create an http server on the specified port.

Access the Query Plan Viewer:

http://MARKLOGIC_HOST:PORT


73 changes: 73 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#! /bin/bash

usage()
{
cat <<-EOF 1>&2
use: setup.sh [OPTIONS]*
Options: Default
--host=HOST localhost
--port=PORT 9999
--user=USE admin
--pass=PAS admin
--dir=DIR current dir
--group=GROUP Default
EOF
exit 1
}



HOST=localhost
PORT=9999
USER=admin
PASS=admin
DIR="$PWD/${1#./}"
GROUP="Default"

while [ $# != 0 ]; do
case "$1" in
--host=*)
HOST=$(echo $1 | sed 's%--host=%%')
shift;;
--port=*)
PORT=$(echo $1 | sed 's%--port=%%')
shift;;
--dir=*)
DIR=$(echo $1 | sed 's%--dir=%%')
shift;;
--user=*)
USER=$(echo $1 | sed 's%--user=%%')
shift;;
--pass=*)
PASS=$(echo $1 | sed 's%--pass=%%')
shift;;
--group=*)
GROUP=$(echo $1 | sed 's%--group=%%')
shift;;
-?)
usage
;;
*)
echo "Bad option - $1"
usage
;;
esac
done

CURL="curl --anyauth --user ${USER}:${PASS} -s -S"



$CURL -X POST -d @- -H "Content-type: application/json" \
"http://${HOST}:8002/manage/v2/servers" <<-EOF
{ "server-name": "${PORT}-queryplan-viewer",
"server-type": "http",
"group-name": "$GROUP",
"root": "${DIR}",
"port": $PORT,
"content-database": "Documents",
"threads": 32,
"error-handler" : "/MarkLogic/rest-api/error-handler.xqy"
}
EOF

0 comments on commit 20b50a0

Please sign in to comment.