code: public static UUID getLocalHostId()
      {
          String req = "SELECT host_id FROM system.%s WHERE key='%s'";
          UntypedResultSet result = executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY));
  
          // Look up the Host UUID (return it if found)
          if (!result.isEmpty() && result.one().has("host_id"))
              return result.one().getUUID("host_id");
  
          // ID not found, generate a new one, persist, and then return it.
          UUID hostId = UUID.randomUUID();
          logger.warn("No host ID found, created {} (Note: This should happen exactly once per node).", hostId);
          return setLocalHostId(hostId);
      }
docs: Read the host ID from the system keyspace, creating (and storing) one if
  none exists.