Memcache is basically a standard for development, but for memcache clusters, many on-line deployments are still very thin.
Several existing problems: not robust, data insecure, configuration changes may result in access anomalies, backup data consistency
In view of the above problems, Memcache's development team has developed membase, supporting multiple server clusters, slicing and replicating data, effectively improving service stability and data security, and supporting persistent storage of data. The stability of the code is not good enough, I used a part of the online business membase, and later because of a few inexplicable access operation slow, can only be withdrawn back to Memcache.
The Membase team then merged with the COUCHDB team to launch the two-in-product: Couchbase.
The biggest features of Couchbase:
1, fully inherit memcache, native support all memcache operation;
2, inherit the characteristics of Membase, support cluster and data persistence;
3, inherit the document nature of COUCHDB, support the operation of data through view. The feature of this view provides the convenience that Memcache previously did not have, but it is simple and primitive compared to MongoDB, it is not a function of universal demand.
First, from the installation:
Install the server:
Go to the official website to download the corresponding version of the installation package http://www.couchbase.com currently the latest version is 2.1.1
Starting with Membase, the Web-based management is advocated (http://localhost:8091 port access in the browser after the installation file is executed), and the default is Port 8091.
Another piece of information is about the port. 11211 is the Memcache access port, 8091 is the management and Operation Port, and several others are used for management and cluster communication.
Open 8091 to initialize the settings:
The initialization process is very user-friendly, the first step is to select the physical storage location, and set a new creation or join an existing cluster.
If you choose to create new, you need to specify the amount of memory to use (note that if the MEM memory for all clusters in the cluster must be greater than this value). In the next step, you can also choose to automatically fill in some test data, so that you can directly experience some of the effects of view.
The next step is to create a default bucket setting, which is important:
The meaning of buckets is to separate the data, for example: Any view is based on a bucket and only the data in the bucket is processed. A server can have multiple buckets, each bucket storage type, content occupancy, data replication quantity, etc., need to be specified separately. In this sense, each bucket is equivalent to a separate instance. In the cluster state, we need to set up the server cluster, the bucket only focus on the storage of data.
To create buckets, you need to indicate the type of drive: memcached as the name implies, pure memory, no copy set and other functions; the couchbase type is with persistent storage and can have a copy set.
With regard to replication sets, you can set: Prohibit replication sets, number of replicas (if set to 2, data will be saved on two nodes, any one node corruption data still exists), and whether the index is replicated. Flush, refers to whether to support the operation of emptying all data.
The recommendation is to use the Couchbase type, set the memory usage, and others by default. For memory settings, try not to allocate all the memory on the server, leave some free, and test the new bucket is convenient. Of course, the amount of memory the bucket occupies can be dynamically adjusted after it is built.
Follow the prompts, after setting the administrator password, the service can be used. On the homepage of the management interface, you can see the overview of the operation:
In the Servernodes frame, you can view the server cluster, and in view, you can manage the view in each bucket, and in databuckets, manage the buckets. For example, adjust memory consumption:
With only one server node, replica is meaningless, let's build a second server node. The installation process is similar, here choose to join the cluster, fill in the IP and password:
Click Next and verify that you are ready to join the cluster. Any server in the cluster, the status is equivalent, can be managed by a browser connection.
As you can see, the newly joined server is in the Pending state, which means that the data has not been synchronized. This node can provide services only after the data is synchronized. Click the rebalance button to synchronize the data. There's a progress bar showing that it's really thoughtful.
Memcache Upgrade: Couchbase installation configuration and instructions for use