Upload
couchbase
View
316
Download
2
Tags:
Embed Size (px)
Citation preview
COUCHBASE SYNC GATEWAY
James Nocentini, Developer Advocate, Couchbase
©2014 Couchbase Inc.
Schedule
2
Sync Gateway in-depth 1-1:30pm
Hands-on, Part 2: Replications 1:30-2pm
Data orchestration with Sync Gateway 2-2:30pm
Break 2:30-3pm
Hands-on, Part 3: Data orchestration 3-4pm
Demo Sync Gateway
Demo Couchbase Server
vs.
Sync Cache
Sync
©2014 Couchbase Inc.
Sync
Push → Pull ←
7
©2014 Couchbase Inc.
Sync
Push → Couchbase Sync Gateway Pull ← Couchbase Sync Gateway
8
©2014 Couchbase Inc.
Sync
9
public class HomeActivity extends Activity{ private static final String SYNC_URL = "http://localhost:4984/todos/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Replication pull = database.createPullReplication(SYNC_URL);
pull.start(); }}
Replication Algorithm
©2014 Couchbase Inc.
Sync
11
public class HomeActivity extends Activity{ private static final String SYNC_URL = "http://localhost:4984/todos/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Authenticator authenticator = AuthenticatorFactory.createFacebookAuthenticator(token); Replication pull = database.createPullReplication(SYNC_URL); pull.setAuthenticator(authenticator);
pull.start(); }}
©2014 Couchbase Inc.
Replications
12
Step 8
©2015 Couchbase Inc. ‹#›
Step 8: Replication without authentication
▪ push/pull replications
▪ in continuous mode
©2014 Couchbase Inc.
Sync
15
public class HomeActivity extends Activity{ private static final String SYNC_URL = "http://10.10.106.24:4984/todos/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
Replication pull = database.createPullReplication(SYNC_URL); pull.setContinuous(true); pull.start(); }}
Step 9
©2015 Couchbase Inc. ‹#›
Sync Gateway Basic Authentication
▪ create a user: POST request @ http://10.10.106.24:8080/signup
▪ use those credentials to replicate as an existing user
©2014 Couchbase Inc.
Sync
18
public class HomeActivity extends Activity{ private static final String SYNC_URL = "http://10.10.106.24:4984/todos/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
Replication pull = database.createPullReplication(SYNC_URL);pull.setContinuous(true);
pull.start(); }}
©2014 Couchbase Inc.
Sync
19
public class HomeActivity extends Activity{ private static final String SYNC_URL = "http://10.10.106.24:4984/todos/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
Authenticator authenticator = AuthenticatorFactory.createBasicAuthenticator(name, password);Replication pull = database.createPullReplication(SYNC_URL);pull.setContinuous(true);
pull.start(); }}
©2014 Couchbase Inc.
Sync
20
public class HomeActivity extends Activity{ private static final String SYNC_URL = "http://10.10.106.24:4984/todos/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
Authenticator authenticator = AuthenticatorFactory.createBasicAuthenticator(name, password);Replication pull = database.createPullReplication(SYNC_URL);pull.setContinuous(true); pull.setAuthenticator(authenticator);
pull.start(); }}
Midpoint code: git fetch git checkout workshop/midpoint