Jak usunąć wszystkie dane z solr i hbase
Jak usunąć wszystkie dane z solr
poleceniem? Używamy solr
z lily
i hbase
.
Jak mogę usunąć dane z HBase i solr?
Http://lucene.apache.org/solr/4_10_0/tutorial.html#Deleting + Dane
16 answers
Jeśli chcesz wyczyścić indeks Solr -
Możesz odpalić url http-
http://host:port/solr/[core name]/update?stream.body=<delete><query>*:*</query></delete>&commit=true
(zastąp [core name]
nazwą rdzenia, z którego chcesz usunąć). Lub użyj tego, jeśli publikujesz dane xml:
<delete><query>*:*</query></delete>
Upewnij się, że używasz commit=true
do zatwierdzania zmian
Nie mam jednak zbyt dużego pomysłu na czyszczenie danych hbase.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-09-29 19:11:19
Użyłem tej prośby, aby usunąć wszystkie moje rekordy, ale czasami jest to konieczne, aby To zatwierdzić.
W tym celu dodaj &commit=true
do swojej prośby:
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/doraprojects.net/template/agent.layouts/content.php on line 54
2011-11-22 17:48:30
Możesz użyć następujących poleceń do usunięcia.
Użyj zapytania "dopasuj wszystkie dokumenty" w poleceniu delete by query:
'<delete><query>*:*</query></delete>
Musisz również zatwierdzić po uruchomieniu delete, aby opróżnić indeks, uruchom następujące dwa polecenia:
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'
Inną strategią byłoby dodanie dwóch zakładek w przeglądarce:
http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>
http://localhost:8983/solr/update?stream.body=<commit/>
Dokumenty źródłowe z 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/doraprojects.net/template/agent.layouts/content.php on line 54
2016-02-09 21:50:52
Jeśli chcesz usunąć wszystkie dane w Solr poprzez SolrJ, zrób coś takiego.
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);
}
}
Jeśli chcesz usunąć wszystkie dane w HBase zrób coś takiego.
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/doraprojects.net/template/agent.layouts/content.php on line 54
2012-10-29 22:40:23
Dane Post json (np. z 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/doraprojects.net/template/agent.layouts/content.php on line 54
2017-07-24 09:23:01
Użyj zapytania "match all docs" w poleceniu delete by query: :
Musisz również zatwierdzić po uruchomieniu delete, aby opróżnić indeks, uruchom następujące dwa polecenia:
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/doraprojects.net/template/agent.layouts/content.php on line 54
2015-05-21 10:58:23
Przyszedłem tutaj, aby usunąć wszystkie dokumenty z instancji solr poprzez. Net framework używając SolrNet. Oto jak udało mi się to zrobić:
Startup.Init<MyEntity>("http://localhost:8081/solr");
ISolrOperations<MyEntity> solr =
ServiceLocator.Current.GetInstance<ISolrOperations<MyEntity>>();
SolrQuery sq = new SolrQuery("*:*");
solr.Delete(sq);
solr.Commit();
To wyczyściło wszystkie dokumenty. (nie jestem pewien, czy można to odzyskać, jestem w fazie uczenia się i testowania Solr, więc proszę rozważyć backup przed użyciem tego kodu) Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-10-24 18:45:10
Odpal to w przeglądarce
http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true
ta komenda usunie wszystkie dokumenty z indeksu w solr
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-02-19 07:54:57
Użyłem tego zapytania, aby usunąć wszystkie moje rekordy.
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/doraprojects.net/template/agent.layouts/content.php on line 54
2016-05-11 07:41:16
Jeśli trzeba wyczyścić wszystkie dane, może być szybsze odtworzenie kolekcji, np.
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/doraprojects.net/template/agent.layouts/content.php on line 54
2015-03-11 21:11:13
Przykłady curl przede wszystkim zawiodły mnie, gdy uruchamiałem je z terminala cygwin. Były takie błędy, gdy uruchomiłem przykład skryptu.
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>
Musiałem użyć delete w pętli na nazwach rdzeni, aby wymazać je wszystkie w projekcie.
Poniższe zapytanie zadziałało dla mnie w skrypcie terminala 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>
Ta jedna linia sprawiła, że dane zniknęły, a zmiana trwała.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-02-16 13:39:52
Z linii poleceń użyj:
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/doraprojects.net/template/agent.layouts/content.php on line 54
2018-09-05 21:58:29
Podczas usuwania indeksu Solr, powinieneś również wykonać commit i zoptymalizować po uruchomieniu zapytania delete-all. Wymagane pełne kroki (curl to wszystko, czego potrzebujesz): 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/doraprojects.net/template/agent.layouts/content.php on line 54
2013-04-15 14:30:38
Zrobiłem zakładkę JavaScript, która dodaje link Usuń w Solr Admin UI
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/doraprojects.net/template/agent.layouts/content.php on line 54
2015-06-15 13:51:12
Jeśli używasz Cloudera 5.x, tutaj w tej dokumentacji jest wspomniane, że Lily utrzymuje również aktualizacje i usunięcia w czasie rzeczywistym.
Konfigurowanie usługi Lily HBase NRT Indexer do użytku z Cloudera Search
Ponieważ HBase stosuje wstawianie, aktualizowanie i usuwanie komórek tabeli HBase, indekser zachowuje zgodność Solr z zawartością tabeli HBase, używając standardowa replikacja Hbazy.
Nie wiem czy {[0] } jest również wspierane w to samo.
W Przeciwnym Razie tworzysz wyzwalacz lub usługę, aby wyczyścić dane zarówno z Solr, jak i HBase na konkretnym zdarzeniu lub czegokolwiek.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-05-24 15:31:18
Solr nie jestem pewien, ale możesz usunąć wszystkie dane z hbase używając polecenia truncate jak poniżej:
truncate 'table_name'
Usunie wszystkie klucze wiersza z tabeli hbase.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-05-16 19:41:57