couchbase training basic

Download Couchbase training basic

If you can't read please download the document

Upload: mycellwasstolencom

Post on 16-Aug-2015

395 views

Category:

Education


0 download

TRANSCRIPT

  1. 1. Introduction ToIntroduction To Shivansh Srivastava Software Consultant Knoldus Software LLP Shivansh Srivastava Software Consultant Knoldus Software LLP
  2. 2. AgendaAgenda Why NoSQL? What is Couchbase? Why Couchbase? Basic CRUD operations. Let's code Why NoSQL? What is Couchbase? Why Couchbase? Basic CRUD operations. Let's code
  3. 3. WHYWHY
  4. 4. Why NoSql..??Why NoSql..??
  5. 5. Why NoSql..??Why NoSql..?? Flexibility: Schema flexibility attracts developers. Scalability: Scale size and number of concurrent user. Availability: Provide different replication architectures. Low Operational Cost: Open Source, Distributed Architecture Specialized Capabilities: Automatic data replication, Rest Api's, Indexing features.
  6. 6. What is Couchbase?What is Couchbase?
  7. 7. DistributedNoSQLdocumentorienteddatabase. TwotypesofAccess: Keyvalueaccess. Documentaccess. KeyFeatures: ViewsandIndexes. GlobalSecondaryIndexing. MultidimensionalScaling. N1QLQuery(Nickel) DistributedNoSQLdocumentorienteddatabase. TwotypesofAccess: Keyvalueaccess. Documentaccess. KeyFeatures: ViewsandIndexes. GlobalSecondaryIndexing. MultidimensionalScaling. N1QLQuery(Nickel) Couchbase
  8. 8. Why Couchbase?Why Couchbase?
  9. 9. Enterprise Edition FeaturesEnterprise Edition Features
  10. 10. Rack Awareness Encrypted administrative access Encrypted data access XDCR data encryption Incremental backup and restore Rack Awareness Encrypted administrative access Encrypted data access XDCR data encryption Incremental backup and restore Key Features in Enterprise Edition
  11. 11. Installing CouchbaseInstalling Couchbase
  12. 12. Steps of InstallationSteps of Installation Download Couchbase from their official website. Install the package using the dpkg command as a privileged user under sudo. For example: sudo dpkg i couchbase-server-enterprise_4.0.0-beta- ubuntu14.04_amd64.deb
  13. 13. Setting up Couchbase Server.Setting up Couchbase Server.
  14. 14. Open a browser and navigate to http://hostname:8091/ for configuring your server. Click Setup. On the Configure Server screen, select check boxes for data, query, and index services and click next, to start a new cluster. Open a browser and navigate to http://hostname:8091/ for configuring your server. Click Setup. On the Configure Server screen, select check boxes for data, query, and index services and click next, to start a new cluster. Steps for Configuring Couchbase Server
  15. 15. Sample Buckets screen: Select bucket you want to include and then click Next. Default Bucket screen: Click Next to accept the default values. Notifications screen: Agree to the terms and conditions, and click Next. Configure Server screen: Enter a password for the Administrator user name, and then click Next. Sample Buckets screen: Select bucket you want to include and then click Next. Default Bucket screen: Click Next to accept the default values. Notifications screen: Agree to the terms and conditions, and click Next. Configure Server screen: Enter a password for the Administrator user name, and then click Next. Continued..
  16. 16. Finally Succeeded..!!!!
  17. 17. CRUD Operations in CouchbaseCRUD Operations in Couchbase
  18. 18. Dependency InjectionDependency Injection We have to inject these two dependencies for enabling the use of couchbase in our project.
  19. 19. Setting up connectionSetting up connection //Required imports import com.couchbase.client.java.{Bucket, CouchbaseCluster} //Create cluster and open bucket val cluster = CouchbaseCluster.create(127.0.0.3) val bucket = cluster.openBucket(user) //case class to store data in bucket case class User(name:String, email: String)
  20. 20. Create and Update OperationCreate and Update Operation .upsert(Document):Document It updates a document according to the key,and if document is not present it creates and it returns the document itself.
  21. 21. Retrieve OperationRetrieve Operation .get(key:String):JsonDocument It retrieves the Json document on the basis of the key that is passed.
  22. 22. Delete OperationDelete Operation .remove(key:String): JsonDocument It removes the document from the bucket according to the user id that is passed and returns that Json Document itself.
  23. 23. Thank youThank you