Exemple #1
0
def remove_one_replica_from_elasticsearch_index(cluster: str,
                                                index: str,
                                                force: bool = False):
    """Remove one replica."""

    elastic = sreElastic(host=cluster)
    elastic.decr_replica_amount(index=index, without_confirmation=force)
Exemple #2
0
def add_one_replica_to_elasticsearch_index(cluster: str,
                                           index: str,
                                           force: bool = False):
    """Add one replica."""

    elastic = sreElastic(host=cluster)
    elastic.incr_replica_amount(index=index, without_confirmation=force)
Exemple #3
0
def show_elasticsearch_index_info(cluster: str, index: str):
    """Show index allocation and routing settings."""

    elastic = sreElastic(host=cluster)
    pp = pprint.PrettyPrinter(indent=2, width=120)

    print("\nLocation:")
    pp.pprint(elastic.get_index_location(index))
    print("\nRouting:")
    pp.pprint(elastic.get_index_routing(index))
    print("\n")
Exemple #4
0
def move_index_to_nodes(cluster: str,
                        index: str,
                        nodes: tuple,
                        timeout: int,
                        force: bool = False):
    """Move index shard by shard to the new location."""

    elastic = sreElastic(host=cluster)
    elastic.move_index_to_custom_nodes(index=index,
                                       nodes=nodes,
                                       timeout=timeout,
                                       without_confirmation=force)
Exemple #5
0
def reset_elasticsearch_index_allocation(cluster: str, index: str):
    """Reset index allocation (remove allocation settings)."""

    elastic = sreElastic(host=cluster)
    elastic.index_reset(index=index)
Exemple #6
0
def fix__elasticsearch_index_allocation(cluster: str, index: str):
    """Fix index allocation to the current data nodes."""

    elastic = sreElastic(host=cluster)
    elastic.index_fix(index=index)
Exemple #7
0
def wait_for_elasticsearch_index(cluster: str, index: str):
    """Wait until index relocating"""

    elastic = sreElastic(host=cluster)
    elastic.wait_index_relocation(index=index)
Exemple #8
0
def show_elasticsearch_indices(cluster: str, node: str):
    """Show elasticsearch indices with additional information"""

    elastic = sreElastic(host=cluster)
    elastic.list_indices(only_this_node=node)
Exemple #9
0
def delete_elasticsearch_index(cluster: str, index: str):
    """Delete index."""

    elastic = sreElastic(host=cluster)
    elastic.delete_index(index=index)
Exemple #10
0
def setup_index_shards_per_node(cluster: str, index: str, number: int):
    """Set number of shards per one node setting."""

    elastic = sreElastic(host=cluster)
    elastic.set_number_shards_per_node(index=index, number=number)