Package org.apache.accumulo.core.security.thrift

Examples of org.apache.accumulo.core.security.thrift.AuthInfo


 
  private static void checkTabletServer(final String user, final byte[] pass, Entry<String,List<KeyExtent>> entry, HashSet<KeyExtent> failures)
      throws ThriftSecurityException, TException, NoSuchScanIDException {
    TabletClientService.Iface client = ThriftUtil.getTServerClient(entry.getKey(), AccumuloConfiguration.getSystemConfiguration());
   
    AuthInfo st = new AuthInfo(user, pass, HdfsZooInstance.getInstance().getInstanceID());
    Map<TKeyExtent,List<TRange>> batch = new TreeMap<TKeyExtent,List<TRange>>();
   
    for (KeyExtent keyExtent : entry.getValue()) {
      Text row = keyExtent.getEndRow();
      Text row2 = null;
View Full Code Here


 
  private static List<KeyExtent> findTablets(boolean selectLocalTablets, String user, String pass, String table, ZooKeeperInstance zki,
      Map<KeyExtent,String> locations) throws Exception {
    SortedSet<KeyExtent> tablets = new TreeSet<KeyExtent>();
   
    MetadataTable.getEntries(zki, new AuthInfo(user, pass.getBytes(), zki.getInstanceID()), table, false, locations, tablets);
   
    InetAddress localaddress = InetAddress.getLocalHost();
   
    List<KeyExtent> candidates = new ArrayList<KeyExtent>();
   
View Full Code Here

 
  private static List<String> getTabletFiles(String user, String pass, ZooKeeperInstance zki, String tableId, KeyExtent ke) {
    List<String> files = new ArrayList<String>();
   
    SortedMap<Key,Value> tkv = new TreeMap<Key,Value>();
    MetadataTable.getTabletAndPrevTabletKeyValues(zki, tkv, ke, null, new AuthInfo(user, pass.getBytes(), zki.getInstanceID()));
   
    Set<Entry<Key,Value>> es = tkv.entrySet();
    for (Entry<Key,Value> entry : es) {
      if (entry.getKey().compareRow(ke.getMetadataEntry()) == 0) {
        if (entry.getKey().compareColumnFamily(Constants.METADATA_DATAFILE_COLUMN_FAMILY) == 0) {
View Full Code Here

        everythingLooksGood = false;
      }
      if (broke && patch) {
        KeyExtent ke = new KeyExtent(tabke);
        ke.setPrevEndRow(lastEndRow);
        MetadataTable.updateTabletPrevEndRow(ke, new AuthInfo(user, pass, HdfsZooInstance.getInstance().getInstanceID()));
        System.out.println("KE " + tabke + " has been repaired to " + ke);
      }
     
      lastEndRow = tabke.getEndRow();
    }
View Full Code Here

    Scanner scanner;
   
    if (offline) {
      scanner = new OfflineMetadataScanner();
    } else {
      scanner = new ScannerImpl(HdfsZooInstance.getInstance(), new AuthInfo(user, pass, HdfsZooInstance.getInstance().getInstanceID()),
          Constants.METADATA_TABLE_ID, Constants.NO_AUTHS);
    }
   
    scanner.setRange(Constants.METADATA_KEYSPACE);
    ColumnFQ.fetch(scanner, Constants.METADATA_PREV_ROW_COLUMN);
    scanner.fetchColumnFamily(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY);
   
    Text colf = new Text();
    Text colq = new Text();
    boolean justLoc = false;
   
    int count = 0;
   
    for (Entry<Key,Value> entry : scanner) {
      colf = entry.getKey().getColumnFamily(colf);
      colq = entry.getKey().getColumnQualifier(colq);
     
      count++;
     
      String tableName = (new KeyExtent(entry.getKey().getRow(), (Text) null)).getTableId().toString();
     
      TreeSet<KeyExtent> tablets = tables.get(tableName);
      if (tablets == null) {
        Set<Entry<String,TreeSet<KeyExtent>>> es = tables.entrySet();
       
        for (Entry<String,TreeSet<KeyExtent>> entry2 : es) {
          checkTable(entry2.getKey(), entry2.getValue(), patch);
        }
       
        tables.clear();
       
        tablets = new TreeSet<KeyExtent>();
        tables.put(tableName, tablets);
      }
     
      if (Constants.METADATA_PREV_ROW_COLUMN.equals(colf, colq)) {
        KeyExtent tabletKe = new KeyExtent(entry.getKey().getRow(), entry.getValue());
        tablets.add(tabletKe);
        justLoc = false;
      } else if (colf.equals(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY)) {
        if (justLoc) {
          System.out.println("Problem at key " + entry.getKey());
          sawProblems = true;
          if (patch) {
            Writer t = MetadataTable.getMetadataTable(new AuthInfo(user, pass, HdfsZooInstance.getInstance().getInstanceID()));
            Key k = entry.getKey();
            Mutation m = new Mutation(k.getRow());
            m.putDelete(k.getColumnFamily(), k.getColumnQualifier());
            try {
              t.update(m);
View Full Code Here

    this.instance = instance;
   
    // copy password so that user can clear it.... in future versions we can clear it...
    byte[] passCopy = new byte[password.length];
    System.arraycopy(password, 0, passCopy, 0, password.length);
    this.credentials = new AuthInfo(user, password, instance.getInstanceID());
   
    // hardcoded string for SYSTEM user since the definition is
    // in server code
    if (!user.equals("!SYSTEM")) {
      ClientService.Iface client = null;
View Full Code Here

          h.getDescPadding(), null, true);
      System.exit(3);
    }
   
    try {
      AuthInfo creds;
      if (args[0].equalsIgnoreCase("stop")) {
        stopTabletServer(args[1]);
      } else {
        if (!cl.hasOption("u") && !cl.hasOption("p")) {
          creds = SecurityConstants.systemCredentials;
        } else {
          if (pass == null) {
            try {
              pass = new ConsoleReader().readLine("Enter current password for '" + user + "': ", '*').getBytes();
            } catch (IOException ioe) {
              log.error("Password not specified and unable to prompt: " + ioe);
              System.exit(4);
            }
          }
          creds = new AuthInfo(user, pass, HdfsZooInstance.getInstance().getInstanceID());
        }
       
        everything = args[0].equalsIgnoreCase("stopAll");
        stopServer(creds, everything);
      }
View Full Code Here

      return new MockTabletLocator();
    Instance instance = getInstance(job);
    String username = getUsername(job);
    byte[] password = getPassword(job);
    String tableName = getTablename(job);
    return TabletLocator.getInstance(instance, new AuthInfo(username, password, instance.getInstanceID()), new Text(Tables.getTableId(instance, tableName)));
  }
View Full Code Here

  private String getInstanceName() {
    return instanceName;
  }
 
  protected AuthInfo getCredentials() {
    return new AuthInfo(getUsername(), getPassword().getBytes(), getInstance().getInstanceID());
  }
View Full Code Here

    if (args.length > 1 || new HashSet<String>(Arrays.asList(args)).contains("-?")) {
      System.err.println("Usage: bin/accumulo " + AddFilesWithMissingEntries.class.getName() + " [update]");
      System.exit(1);
    }
    update = args.length > 0;
    final AuthInfo creds = SecurityConstants.systemCredentials;
    final Connector connector = HdfsZooInstance.getInstance().getConnector(creds.getUser(), creds.getPassword());
    final Key rootTableEnd = new Key(Constants.ROOT_TABLET_EXTENT.getEndRow());
    final Range range = new Range(rootTableEnd.followingKey(PartialKey.ROW), true, Constants.METADATA_RESERVED_KEYSPACE_START_KEY, false);
    final Scanner scanner = connector.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
    scanner.setRange(range);
    final Configuration conf = new Configuration();
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.security.thrift.AuthInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.