create couchbase data buckets
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 3 Sep 2011 21:21:27 +0000 (21:21 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 3 Sep 2011 21:21:27 +0000 (21:21 +0000)
couchbase/create.sh [new file with mode: 0755]
couchbase/dev_test.json [new file with mode: 0644]

diff --git a/couchbase/create.sh b/couchbase/create.sh
new file mode 100755 (executable)
index 0000000..5651b9c
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh -xe
+
+membase() {
+       /opt/couchbase/bin/membase $* -c 127.0.0.1:8091 -u Administrator -p cbadmin
+}
+
+membase server-list
+membase server-info
+
+membase bucket-list | grep files && membase bucket-delete --bucket=files
+
+membase bucket-list
+
+membase rebalance
+
+membase bucket-create --bucket=files \
+       --bucket-type=membase \
+       --bucket-port=5800 \
+       --bucket-ramsize=100 \
+       --bucket-replica=1
+
+membase bucket-list
+
+curl http://localhost:8091/couchBase/files/_design/dev_test > dev_test.new && curl -X DELETE http://localhost:8091/couchBase/files/_design/dev_test
+curl -X PUT http://localhost:8091/couchBase/files/_design/dev_test -T dev_test.json
+#curl -X PUT http://localhost:8091/couchBase/files/_design/test -T test.json
diff --git a/couchbase/dev_test.json b/couchbase/dev_test.json
new file mode 100644 (file)
index 0000000..c8def67
--- /dev/null
@@ -0,0 +1 @@
+{"_id":"_design/dev_test","views":{"login_host_count":{"map":"function (doc) {\n  if(doc.login.length && doc.host.length && doc.size)\n    emit( [doc.login,doc.host] ,1);\n}","reduce":"_count"},"login_host_size_sum":{"map":"function (doc) {\n  if(doc.login.length && doc.host.length && doc.size)\n    emit( [doc.login,doc.host] ,doc.size * 1);\n}","reduce":"_sum"},"md5_login_count":{"map":"function (doc) {\n  if(doc.login.length && doc.host.length && doc.size)\n    emit( [doc.md5,doc.login] ,1);\n}","reduce":"_count"},"login_files":{"map":"function (doc) {\n  emit([doc.login,doc.file], doc.md5);\n}"},"login_file_md5":{"map":"function (doc) {\n  emit([doc.login,doc.file], doc.md5);\n}"}}}