blob: d477f9f75702ce98505b75920a72ba7153667184 [file] [log] [blame]
% 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.
\chapter{Accumulo Shell}
Accumulo provides a simple shell that can be used to examine the contents and
configuration settings of tables, insert/update/delete values, and change
configuration settings.
The shell can be started by the following command:
\small
\begin{verbatim}
$ACCUMULO_HOME/bin/accumulo shell -u [username]
\end{verbatim}
% stupid emacs is confused by $ACCUMULO
\normalsize
The shell will prompt for the corresponding password to the username specified
and then display the following prompt:
\small
\begin{verbatim}
Shell - Apache Accumulo Interactive Shell
-
- version 1.3
- instance name: myinstance
- instance id: 00000000-0000-0000-0000-000000000000
-
- type 'help' for a list of available commands
-
\end{verbatim}
\normalsize
\section{Basic Administration}
The Accumulo shell can be used to create and delete tables, as well as to configure
table and instance specific options.
\small
\begin{verbatim}
root@myinstance> tables
!METADATA
root@myinstance> createtable mytable
root@myinstance mytable>
root@myinstance mytable> tables
!METADATA
mytable
root@myinstance mytable> createtable testtable
root@myinstance testtable>
root@myinstance junk> deletetable testtable
root@myinstance>
\end{verbatim}
\normalsize
The Shell can also be used to insert updates and scan tables. This is useful for
inspecting tables.
\small
\begin{verbatim}
root@myinstance mytable> scan
root@myinstance mytable> insert row1 colf colq value1
insert successful
root@myinstance mytable> scan
row1 colf:colq [] value1
\end{verbatim}
\normalsize
The value in brackets "[]" would be the visibility labels. Since none were used, this is empty for this row.
You can use the "-t" option to scan to see the timestamp for the cell, too.
\section{Table Maintenance}
The \textbf{compact} command instructs Accumulo to schedule a compaction of the table during which
files are consolidated and deleted entries are removed.
\small
\begin{verbatim}
root@myinstance mytable> compact -t mytable
07 16:13:53,201 [shell.Shell] INFO : Compaction of table mytable
scheduled for 20100707161353EDT
\end{verbatim}
\normalsize
The \textbf{flush} command instructs Accumulo to write all entries currently in memory for a given table
to disk.
\small
\begin{verbatim}
root@myinstance mytable> flush -t mytable
07 16:14:19,351 [shell.Shell] INFO : Flush of table mytable
initiated...
\end{verbatim}
\normalsize
\section{User Administration}
The Shell can be used to add, remove, and grant privileges to users.
\small
\begin{verbatim}
root@myinstance mytable> createuser bob
Enter new password for 'bob': *********
Please confirm new password for 'bob': *********
root@myinstance mytable> authenticate bob
Enter current password for 'bob': *********
Valid
root@myinstance mytable> grant System.CREATE_TABLE -s -u bob
root@myinstance mytable> user bob
Enter current password for 'bob': *********
bob@myinstance mytable> userpermissions
System permissions: System.CREATE_TABLE
Table permissions (!METADATA): Table.READ
Table permissions (mytable): NONE
bob@myinstance mytable> createtable bobstable
bob@myinstance bobstable>
bob@myinstance bobstable> user root
Enter current password for 'root': *********
root@myinstance bobstable> revoke System.CREATE_TABLE -s -u bob
\end{verbatim}
\normalsize