Couchbase Basics

Couchbase Basics



Couchbase is a distributed data-store that enjoys true horizontal scaling.
I like to think of it as a mix of Redis and MongoDB: you work with documents that are accessed through their keys.
cbq : Its a tool, that allows you to run N1QL querys from command line.
Couchbase server stores the data files (database and indices) under C:\Program Files\Couchbase\Server\var\lib\couchbase\data\simple (Windows)
Here in the screenshot “simple” is the bucket name
couchbase_data_loc

Caching layer

Couchbase Server includes a built-in caching layer which acts as a central part of the server and provides very rapid reads and writes of data.
Couchbase Server automatically manages the caching layer and coordinates with disk space to ensure that enough cache space exists to maintain performance. It automatically places items that come into the caching layer into disk queue so that it can write these items to disk. If the server determines that a cached item is infrequently used, it removes it from RAM to free space for other items. Similarly the server retrieves infrequently-used items from disk and stores them into the caching layer when the items are requested. In order to provide the most frequently-used data while maintaining high performance, Couchbase Server manages a working set of your entire information. The working set is the data most frequently accessed and is kept in RAM for high performance.
Couchbase automatically moves data from RAM to disk asynchronously, in the background, to keep frequently used information in memory and less frequently used data on disk. Couchbase constantly monitors the information accessed by clients and decides how to keep the active data within the caching layer. Data is ejected to disk from memory while the server continues to service active requests. During sequences of high writes to the database, clients are notified that the server is temporarily out of memory until enough items have been ejected from memory to disk. The asynchronous nature and use of queues in this way enables reads and writes to be handled at a very fast rate, while removing the typical load and performance spikes that would otherwise cause a traditional RDBMS to produce erratic performance.
When the server stores data on disk and a client requests the data, an individual document ID is sent and then the server determines whether the information exists or not. Couchbase Server does this with metadata structures. The metadata holds information about each document in the database and this information is held in RAM. This means that the server returns a ‘document ID not found’ response for an invalid document ID, returns the data from RAM, or returns the data after being fetched from disk.
Using CURL
You can use curl to execute query statements and view the results
The following is the command:-
curl http://localhost:8093/query/service -d “statement=select * from where _class=’com.mob.auth.modal.Run'” -u Administrator:password
 curl-couchbase


No comments:

 Python Basics How to check the version of Python interpreter mac terminal

Popular in last 30 days