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

update master #3

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,10 @@ CTestTestfile.cmake
.DS_Store
Testing
cmake-build-debug
.idea
.idea

gnuplot*
googletest*
loguru*
rapidjson*

12 changes: 12 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ To build this set of utilities on linux, osx and windows platforms.

Note that running cmake will pull down dependencies.

Then run make, make install

and to create a release package

>cpack3 --config CPackConfig.cmake
Expand Down
97 changes: 51 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

Small collection of home grown command line utilities for working with MarkLogic.

* ml-log: retrieve server logs
* ml-hist: retrieve resource metrics (requires gnuplot for graphing)
* ml-status: retrieve resource status
* ml-xq: evaluate xquery
* ml-js: evaluate javascript
* ml-load: load data
* ml-config: manage MarkLogic
* ml-browse: browse resources

* [ml-log](#ml-log): retrieve server logs
* [ml-hist](#ml-hist): retrieve resource metrics (requires gnuplot for graphing)
* [ml-status](#ml-status): retrieve resource status
* [ml-xq](#ml-xq): evaluate xquery
* [ml-js](#ml-js): evaluate javascript
* [ml-load](#ml-load): load data
* [ml-config](#ml-config): manage MarkLogic
* [ml-browse](#ml-browse): browse resources

__WARNING__- Use these utilities at your own risk they are not supported in any way.

Expand All @@ -31,7 +32,7 @@ pass=admin
port=8002
path=/manage/v2
```

2) copy bin/* to your bin directory or amend PATH

3) run utils
Expand All @@ -43,7 +44,7 @@ retrieve history metrics

retrieve server logs
```
> ./ml-log -n ErrorLog.txt
> ./ml-log -n ErrorLog.txt
```

retrieve resource status
Expand Down Expand Up @@ -86,7 +87,7 @@ option.

## Utilities

### ml-hist
### ml-hist<a name="ml-hist"></a>
retrieve history metrics from cluster/server

__NOTE__ - To use graphing capabilities you must install gnuplot (ex. yum install gnuplot).
Expand Down Expand Up @@ -124,13 +125,13 @@ use custom gnuplot with start and end time range
> ./ml-hist -f json -s 2015-03-21T17:38:00 -e 2017-03-21T17:38:00 -g ../../etc/basic.gnuplot -r servers/Manage -m request-time -o test.png
```

### ml-status
### ml-status<a name="ml-status"></a>
retrieve resource statuses

```
> ./ml-status -h

ml-status [options]
ml-status [options]
-r : resources/{resource-name}
-c : config file (ex. /home/jfuller/.ml-utils)
-f : format (xml|json)
Expand All @@ -141,45 +142,45 @@ ml-status [options]

cluster status (specifying ml-utils config file with -c option)
```
> ./ml-status -c etc/.ml-utils -f json
> ./ml-status -c etc/.ml-utils -f json
```

all forest status
```
> ./ml-status -r forests -c etc/.ml-utils -f json
> ./ml-status -r forests -c etc/.ml-utils -f json
```

forest status
```
> ./ml-status -r forests/Documents -c etc/.ml-utils -f json
> ./ml-status -r forests/Documents -c etc/.ml-utils -f json
```

database status
```
> ./ml-status -r databases/Documents -c etc/.ml-utils -f json
> ./ml-status -r databases/Documents -c etc/.ml-utils -f json
```

all server status
```
> ./ml-status -r servers -c etc/.ml-utils -f json
> ./ml-status -r servers -c etc/.ml-utils -f json
```

all host status
```
> ./ml-status -r hosts -c etc/.ml-utils -f json
> ./ml-status -r hosts -c etc/.ml-utils -f json
```

```
> ./ml-status -r groups/Default -c etc/.ml-utils -f json
> ./ml-status -r groups/Default -c etc/.ml-utils -f json
```

### ml-log
### ml-log<a name="ml-log"></a>
retrieve MarkLogic logs

```
> ./ml-log -h

ml-log
ml-log
-c : config file (ex. /home/jfuller/.ml-utils)
-f : format(xml | json)
-t : host (ex. localhost)
Expand All @@ -193,7 +194,7 @@ ml-log

get log file list
```
> ./ml-log
> ./ml-log
```

retrieve log file
Expand Down Expand Up @@ -221,7 +222,7 @@ watch (like tail) a log
watch "ml-log -n 8002_ErrorLog.txt -t localhost"
```

### ml-load
### ml-load<a name="ml-load"></a>
load data into MarkLogic

```
Expand All @@ -244,10 +245,10 @@ load test.json to /mytest.json into Documents database

load test.xml to /test.xml into Documents database
```
>./ml-load -u /test.xml -d Documents -f ../../etc/test.xml
>./ml-load -u /test.xml -d Documents -f ../../etc/test.xml
```

### ml-js
### ml-js<a name="ml-js"></a>
evaluate javascript

```
Expand All @@ -272,7 +273,7 @@ apply against database (specifying where config file resides with -c)
> ./ml-js -c etc/.ml-utils -j 1+1 -d Documents
```

pipe in
pipe in
```
> echo "1+1" | ./ml-js
```
Expand All @@ -282,7 +283,7 @@ evaluate file
> ./ml-js < text.js
```

### ml-xq
### ml-xq<a name="ml-xq"></a>
evaluate xquery

```
Expand All @@ -308,7 +309,7 @@ apply against database
> ./ml-xq -x 1+1 -d Documents
```

pipe in
pipe in
```
> echo "1+1" | ./ml-xq
```
Expand All @@ -318,12 +319,12 @@ evaluate file
> ./ml-xq < text.xq
```

managing sequence output
managing sequence output
```
> echo "(1,2,3,4)" | ./ml-xq -r
> echo "(1,2,3,4)" | ./ml-xq -r
```

### ml-config
### ml-config<a name="ml-config"></a>
manage MarkLogic


Expand Down Expand Up @@ -352,7 +353,7 @@ get list of databases

create forest with name 'myForest'
```
>./ml-config create -r forests -n myForest
>./ml-config create -r forests -n myForest
```

update forest
Expand All @@ -362,15 +363,15 @@ update forest

get forest 'myForest' properties
```
>./ml-config get-properties -r forests/myForest
>./ml-config get-properties -r forests/myForest
```

install set of resources based on ml-config directory containing properties
```
>./ml-config install
```

### ml-browse
### ml-browse<a name="ml-browse"></a>
TBD browse resources

```
Expand All @@ -387,6 +388,14 @@ TBD browse resources
```

## Build and deploy

To build you may have to install some additional deps:
```
yum install epel-release
yum install cmake3
yum install curl-devel
```

To build this set of utilities on linux, osx and windows platforms.

```
Expand All @@ -395,23 +404,19 @@ To build this set of utilities on linux, osx and windows platforms.

Note that running cmake will pull down dependencies.

then run make, make install.

and to create a release package
```
>cpack3 --config CPackConfig.cmake
```

To build you may have to install some additional deps:
```
yum install epel-release
yum install cmake3
yum install curl-devel
```

### Dependencies
This project uses the following libs:
This project uses the following libs:

* [MarkLogic](https://developer.marklogic.com): requires MarkLogic 8 or greater
* [curl](https://curl.haxx.se/): for http communication
* [rapidjson](https://github.com/miloyip/rapidjson): for json munging
* [rapidjson](https://github.com/miloyip/rapidjson): for json munging
* [loguru](https://github.com/emilk/loguru): for logging
* [gnuplot-cpp](https://github.com/orbitcowboy/gnuplot-cpp): for speaking to gnuplot
* [googletest](https://github.com/google/googletest): for testing
Expand All @@ -424,7 +429,7 @@ The [examples](examples) folder contains a sample configurations and shellscript
[Apache License v2.0](LICENSE)

## Background
This project was originally an unofficial little prototype to put MarkLogic Management REST API through its paces, to
This project was originally an unofficial little prototype to put MarkLogic Management REST API through its paces, to
see how easy it would be to leverage. As it has grown in usefulness (to me), I thought I would
release to wider world. All PR's reviewed and appreciated. Note to self - write more unit tests!

Expand All @@ -434,4 +439,4 @@ Additionally, I wanted to try out a few modern twists
to manage releases makes life easier and the DownloadProject pulling in dependencies for building is
a great tool. Cmake is sufficient for building cross platform apps in spite of my 'Makefile muscle memory'.

* clion: instead of emacs I used clion ... it was 'ok'
* clion: instead of emacs I used clion ... it was 'ok'
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.2
0.2.0
Loading