| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <meta charset="utf-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| |
| <link rel="stylesheet" type="text/css" href="/css/bootstrap/5.3.1/dist/css/bootstrap.min.css"> |
| <link rel="stylesheet" type="text/css" href="/css/fontawesome/fontawesome-free-6.4.2-web/css/all.min.css"> |
| <link rel="stylesheet" type="text/css" href="/css/datatables/bs5/dt-1.13.6/datatables.min.css"> |
| <link rel="stylesheet" type="text/css" href="/css/accumulo.css"> |
| |
| <title>Connecting to Accumulo</title> |
| |
| <script type="text/javascript" src="/js/jquery/3.7.0/jquery.min.js"></script> |
| <script type="text/javascript" src="/js/bootstrap/5.3.1/dist/js/bootstrap.bundle.min.js"></script> |
| <script type="text/javascript" src="/js/datatables/bs5/dt-1.13.6/datatables.min.js"></script> |
| <script type="text/javascript" src="https://www.apachecon.com/event-images/snippet.js"></script> |
| <script type="text/javascript" src="/js/accumulo.js"></script> |
| </head> |
| <body style="padding-top: 100px"> |
| |
| <nav class="navbar navbar-expand-lg navbar-light fixed-top bg-light"> |
| <div class="container"> |
| <a class="navbar-brand" href="/"> |
| <img alt="Apache Accumulo" id="nav-logo" src="/images/accumulo-logo.png" width="200"> |
| </a> |
| <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-items"> |
| <span class="navbar-toggler-icon"></span> |
| </button> |
| <div class="collapse navbar-collapse" id="navbar-items"> |
| <ul class="navbar-nav me-auto"> |
| <li class="nav-item"><a class="nav-link" href="/downloads">Download</a></li> |
| <li class="nav-item"><a class="nav-link" href="/tour">Tour</a></li> |
| <li class="nav-item dropdown"> |
| <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">Releases</a> |
| <ul class="dropdown-menu"> |
| <li><a class="dropdown-item" href="/release/accumulo-3.0.0/">3.0.0 (Latest non-LTM)</a></li> |
| <li><a class="dropdown-item" href="/release/accumulo-2.1.2/">2.1.2 (Latest LTM)</a></li> |
| <li><a class="dropdown-item" href="/release/accumulo-1.10.4/">1.10.4 (Legacy LTM)</a></li> |
| <li><a class="dropdown-item" href="/release/">Archive</a></li> |
| </ul> |
| </li> |
| <li class="nav-item dropdown"> |
| <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">Documentation</a> |
| <ul class="dropdown-menu"> |
| <li><a class="dropdown-item" href="/docs/2.x">User Manual (2.x)</a></li> |
| <li><a class="dropdown-item" href="/docs/2.x/apidocs">Javadocs (2.x)</a></li> |
| <li><a class="dropdown-item" href="/api">Public API</a></li> |
| <li><a class="dropdown-item" href="/quickstart-1.x">Quickstart (1.x)</a></li> |
| <li><a class="dropdown-item" href="/accumulo2-maven-plugin">Accumulo Maven Plugin</a></li> |
| <li><a class="dropdown-item" href="/1.10/accumulo_user_manual.html">User Manual (1.10)</a></li> |
| <li><a class="dropdown-item" href="/1.10/apidocs">Javadocs (1.10)</a></li> |
| <li><a class="dropdown-item" href="/external-docs">External Docs</a></li> |
| <li><a class="dropdown-item" href="/docs-archive/">Archive</a></li> |
| </ul> |
| </li> |
| <li class="nav-item dropdown"> |
| <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">Community</a> |
| <ul class="dropdown-menu"> |
| <li><a class="dropdown-item" href="/contact-us">Contact Us</a></li> |
| <li><a class="dropdown-item" href="/how-to-contribute">How To Contribute</a></li> |
| <li><a class="dropdown-item" href="/people">People</a></li> |
| <li><a class="dropdown-item" href="/related-projects">Related Projects</a></li> |
| </ul> |
| </li> |
| <li class="nav-item"><a class="nav-link" href="/search">Search</a></li> |
| </ul> |
| <ul class="navbar-nav ms-auto"> |
| <li class="nav-item dropdown"> |
| <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"> |
| <img alt="Apache Software Foundation" src="https://www.apache.org/foundation/press/kit/feather.svg" width="15"/> |
| </a> |
| <ul class="dropdown-menu"> |
| <li><a class="dropdown-item" href="https://www.apache.org">Apache Homepage <span class="fa-solid fa-up-right-from-square"></span></a></li> |
| <li><a class="dropdown-item" href="https://www.apache.org/licenses/">License <span class="fa-solid fa-up-right-from-square"></span></a></li> |
| <li><a class="dropdown-item" href="https://www.apache.org/foundation/sponsorship">Sponsorship <span class="fa-solid fa-up-right-from-square"></span></a></li> |
| <li><a class="dropdown-item" href="https://www.apache.org/security">Security <span class="fa-solid fa-up-right-from-square"></span></a></li> |
| <li><a class="dropdown-item" href="https://www.apache.org/foundation/thanks">Thanks <span class="fa-solid fa-up-right-from-square"></span></a></li> |
| <li><a class="dropdown-item" href="https://www.apache.org/foundation/policies/conduct">Code of Conduct <span class="fa-solid fa-up-right-from-square"></span></a></li> |
| <li><a class="dropdown-item" href="https://www.apache.org/foundation/policies/privacy.html">Privacy Policy<span class="fa-solid fa-up-right-from-square"></span></a></li> |
| <li><a class="dropdown-item" href="https://www.apache.org/events/current-event.html">Current Event <span class="fa-solid fa-up-right-from-square"></span></a></li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </nav> |
| |
| |
| <div class="container"> |
| <div class="row"> |
| <div class="col-md-12"> |
| |
| <div id="non-canonical" style="display: none; background-color: #F0E68C; padding-left: 1em;"> |
| Visit the official site at: <a href="https://accumulo.apache.org">https://accumulo.apache.org</a> |
| </div> |
| <div id="content"> |
| |
| <h1 class="title">Connecting to Accumulo</h1> |
| |
| |
| |
| |
| <div id="tour-header"> |
| <h2><a href="/tour/">Accumulo Tour</a>: Connecting to Accumulo</h2> |
| <p class="text-muted">Tour page 2 of 13</p> |
| </div> |
| <div id="tour-content"> |
| <p>Connecting to a live instance of Accumulo is done through the <a href="https://static.javadoc.io/org.apache.accumulo/accumulo-core/2.1.2/org/apache/accumulo/core/client/AccumuloClient.html">AccumuloClient</a> object. This object |
| contains a live connection to Accumulo and will remain open until closed. All client operations |
| can be accessed from this one object.</p> |
| |
| <p>The <a href="https://static.javadoc.io/org.apache.accumulo/accumulo-core/2.1.2/org/apache/accumulo/core/client/Accumulo.html">Accumulo</a> entry point is used to create a client by calling <code class="language-plaintext highlighter-rouge">Accumulo.newClient()</code>. The |
| client can be created from properties by using one of the <code class="language-plaintext highlighter-rouge">from()</code> methods or using the |
| <code class="language-plaintext highlighter-rouge">to()</code> and <code class="language-plaintext highlighter-rouge">as()</code> methods to specify the connection information directly. A later example |
| will illustrate how to create a new client.</p> |
| |
| <p>For the tour, you will use the <code class="language-plaintext highlighter-rouge">client</code> provided by the JShell to perform the required operations. |
| The properties used to create the client can be viewed in the file contained in the <code class="language-plaintext highlighter-rouge">clientPropUrl</code> |
| variable.</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>jshell> /vars |
| | URL clientPropUrl = file:<path_to_accumulo-client.properties file> |
| </code></pre></div></div> |
| |
| <p>Let’s start by using table operations to list the default tables and instance operations to get |
| the instance ID.</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>jshell> client.tableOperations().list().forEach(System.out::println); |
| accumulo.metadata |
| accumulo.replication |
| accumulo.root |
| </code></pre></div></div> |
| |
| <p>Now let’s retrieve the instance ID.</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>jshell> System.out.println(client.instanceOperations().getInstanceID()); |
| 8b9839f7-cdc6-44ca-b527-43db45acc79f |
| </code></pre></div></div> |
| |
| <p>Different types of operations are accessed by their respective methods on the client:</p> |
| |
| <ul> |
| <li>client.tableOperations();</li> |
| <li>client.namespaceOperations();</li> |
| <li>client.securityOperations();</li> |
| <li>client.instanceOperations();</li> |
| <li>client.replicationOperations();</li> |
| </ul> |
| |
| <p>The client is also used to create Scanners and perform batch operations. These will be |
| explored later.</p> |
| |
| |
| </div> |
| |
| <script> |
| document.body.onkeyup = function(e){ |
| |
| if (e.keyCode == '37') { window.location = '/tour/getting-started/'; } |
| |
| |
| |
| if (e.keyCode == '39') { window.location = '/tour/basic-read-write/'; } |
| |
| }; |
| </script> |
| |
| <div class="text-center"> |
| <h2> |
| |
| <a href="/tour/getting-started/"><</a> |
| |
| |
| 2 / 13 |
| |
| <a href="/tour/basic-read-write/">></a> |
| |
| </h2> |
| </div> |
| |
| </div> |
| |
| |
| <footer> |
| |
| <p><a href="https://www.apache.org/foundation/contributing"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support the ASF" id="asf-logo" height="100" /></a></p> |
| |
| <p>Copyright © 2011-2024 <a href="https://www.apache.org">The Apache Software Foundation</a>. |
| Licensed under the <a href="https://www.apache.org/licenses/">Apache License, Version 2.0</a>.</p> |
| |
| <p>Apache®, the names of Apache projects and their logos, and the multicolor feather |
| logo are registered trademarks or trademarks of The Apache Software Foundation |
| in the United States and/or other countries.</p> |
| |
| </footer> |
| |
| |
| </div> |
| </div> |
| </div> |
| </body> |
| </html> |