Cómo eliminar todos los datos de solr y hbase
¿Cómo elimino todos los datos de solr
mediante un comando? Estamos usando solr
con lily
y hbase
.
¿Cómo puedo eliminar datos de hbase y solr?
Http://lucene.apache.org/solr/4_10_0/tutorial.html#Deleting + Datos
16 answers
Si desea limpiar el índice Solr -
Puede disparar http url -
http://host:port/solr/[core name]/update?stream.body=<delete><query>*:*</query></delete>&commit=true
(reemplace [core name]
con el nombre del núcleo del que desea eliminar). O use esto si publica datos xml data:
<delete><query>*:*</query></delete>
Asegúrese de usar commit=true
para confirmar los cambios
No tengo mucha idea con la limpieza de datos hbase sin embargo.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-09-29 19:11:19
He utilizado esta solicitud para borrar todos mis registros, pero a veces es necesario confirmar esto.
Para eso, agregue &commit=true
a su solicitud:
http://host:port/solr/core/update?stream.body=<delete><query>*:*</query></delete>&commit=true
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-11-22 17:48:30
Puede usar los siguientes comandos para eliminar.
Utilice la consulta "emparejar todos los documentos" en un comando eliminar por consulta:
'<delete><query>*:*</query></delete>
También debe confirmar después de ejecutar la eliminación, por lo que, para vaciar el índice, ejecute los siguientes dos comandos:
curl http://localhost:8983/solr/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'
curl http://localhost:8983/solr/update --data '<commit/>' -H 'Content-type:text/xml; charset=utf-8'
Otra estrategia sería agregar dos marcadores en su navegador:
http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>
http://localhost:8983/solr/update?stream.body=<commit/>
Fuente de documentos de SOLR:
https://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-09 21:50:52
Si desea eliminar todos los datos en Solr a través de SolrJ, haga algo como esto.
public static void deleteAllSolrData() {
HttpSolrServer solr = new HttpSolrServer("http://localhost:8080/solr/core/");
try {
solr.deleteByQuery("*:*");
} catch (SolrServerException e) {
throw new RuntimeException("Failed to delete data in Solr. "
+ e.getMessage(), e);
} catch (IOException e) {
throw new RuntimeException("Failed to delete data in Solr. "
+ e.getMessage(), e);
}
}
Si desea eliminar todos los datos en HBase, haga algo como esto.
public static void deleteHBaseTable(String tableName, Configuration conf) {
HBaseAdmin admin = null;
try {
admin = new HBaseAdmin(conf);
admin.disableTable(tableName);
admin.deleteTable(tableName);
} catch (MasterNotRunningException e) {
throw new RuntimeException("Unable to delete the table " + tableName
+ ". The actual exception is: " + e.getMessage(), e);
} catch (ZooKeeperConnectionException e) {
throw new RuntimeException("Unable to delete the table " + tableName
+ ". The actual exception is: " + e.getMessage(), e);
} catch (IOException e) {
throw new RuntimeException("Unable to delete the table " + tableName
+ ". The actual exception is: " + e.getMessage(), e);
} finally {
close(admin);
}
}
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-10-29 22:40:23
Datos Post json (por ejemplo, con curl)
curl -X POST -H 'Content-Type: application/json' \
'http://<host>:<port>/solr/<core>/update?commit=true' \
-d '{ "delete": {"query":"*:*"} }'
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-24 09:23:01
Utilice la consulta "match all docs" en un comando eliminar por consulta: :
También debe confirmar después de ejecutar la eliminación, por lo que, para vaciar el índice, ejecute los siguientes dos comandos:
curl http://localhost:8983/solr/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'
curl http://localhost:8983/solr/update --data '<commit/>' -H 'Content-type:text/xml; charset=utf-8'
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-21 10:58:23
Vine aquí buscando eliminar todos los documentos de la instancia de solr a través de.Net framework usando SolrNet. Así es como pude hacerlo:
Startup.Init<MyEntity>("http://localhost:8081/solr");
ISolrOperations<MyEntity> solr =
ServiceLocator.Current.GetInstance<ISolrOperations<MyEntity>>();
SolrQuery sq = new SolrQuery("*:*");
solr.Delete(sq);
solr.Commit();
Esto ha borrado todos los documentos. (No estoy seguro de si esto podría ser recuperado, estoy en la fase de aprendizaje y prueba de Solr, así que por favor considere la copia de seguridad antes de usar este código)
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-10-24 18:45:10
Dispara esto en el navegador
http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true
este comando eliminará todos los documentos en index en solr
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-19 07:54:57
He usado esta consulta para borrar todos mis registros.
http://host/solr/core-name/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&commit=true
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-05-11 07:41:16
Si necesita limpiar todos los datos, podría ser más rápido volver a crear la colección, por ejemplo,
solrctl --zk localhost:2181/solr collection --delete <collectionName>
solrctl --zk localhost:2181/solr collection --create <collectionName> -s 1
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-03-11 21:11:13
Los ejemplos de curl sobre todo fallaron para mí cuando los ejecuté desde una terminal cygwin. Hubo errores como este cuando ejecuté el ejemplo de script.
curl http://192.168.2.20:7773/solr/CORE1/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><int name="QTime">1</int></lst>
</response>
<!--
It looks like it deleted stuff, but it did not go away
maybe because the committing call failed like so
-->
curl http://192.168.1.2:7773/solr/CORE1/update --data-binary '' -H 'Content-type:text/xml; charset=utf-8'
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">400</int><int name="QTime">2</int></lst><lst name="error"><str name="msg">Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]</str><int name="code">400</int></lst>
</response>
Necesitaba usar la eliminación en un bucle en los nombres del núcleo para eliminarlos todos en un proyecto.
Esta consulta a continuación funcionó para mí en el script de terminal Cygwin.
curl http://192.168.1.2:7773/hpi/CORE1/update?stream.body=<delete><query>*:*</query></delete>&commit=true
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><int name="QTime">1</int></lst>
</response>
Esta línea hizo que los datos desaparecieran y el cambio persistió.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-16 13:39:52
Desde la línea de comandos use:
bin/post -c core_name -type text/xml -out yes -d $'<delete><query>*:*</query></delete>'
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-09-05 21:58:29
Al borrar un índice Solr, también debe hacer un commit y optimizar después de ejecutar la consulta delete-all. Pasos completos requeridos (curl es todo lo que necesita): http://www.alphadevx.com/a/365-Clearing-a-Solr-search-index
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-04-15 14:30:38
Hice un marcador JavaScript que agrega el enlace eliminar en la interfaz de usuario de administración de Solr
javascript: (function() {
var str, $a, new_href, href, upd_str = 'update?stream.body=<delete><query>*:*</query></delete>&commit=true';
$a = $('#result a#url');
href = $a.attr('href');
str = href.match('.+solr\/.+\/(.*)')[1];
new_href = href.replace(str, upd_str);
$('#result').prepend('<a id="url_upd" class="address-bar" href="' + new_href + '"><strong>DELETE ALL</strong> ' + new_href + '</a>');
})();
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-06-15 13:51:12
Si estás usando Cloudera 5.x, Aquí en esta documentación se menciona que Lily mantiene las actualizaciones y eliminaciones en tiempo real también.
Configuración del servicio Lily HBase NRT Indexer para su uso con Cloudera Search
A medida que HBase aplica inserciones, actualizaciones y eliminaciones a las celdas de la tabla HBase, el indexador mantiene Solr consistente con el contenido de la tabla HBase, utilizando replicación estándar de HBase.
No estoy seguro si truncate 'hTable'
también está soportado en igual.
De lo contrario, crea un Disparador o Servicio para borrar sus datos de Solr y HBase sobre un evento en particular o cualquier cosa.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-05-24 15:31:18
Solr No estoy seguro, pero puede eliminar todos los datos de hbase utilizando el comando truncate como se muestra a continuación:
truncate 'table_name'
Eliminará todas las claves de fila de la tabla hbase.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-16 19:41:57