Skip to content

Instantly share code, notes, and snippets.

View jcantrill's full-sized avatar

Jeff Cantrill jcantrill

View GitHub Profile
#!/bin/bash
POD=$1
enable=${2:-"all"} #or none
PERSIST=${PERSIST:-"transient"}
oc exec -n logging -c elasticsearch $POD -- es_util --query=_cluster/settings -XPUT -d "{\"${PERSIST}\":{\"cluster.routing.allocation.enable\":\"${enable}\"}}"
@jcantrill
jcantrill / allocate-shard
Created July 12, 2018 20:45
allocate a single shard
#!/bin/bash -e
#
# Copyright 2017 Red Hat, Inc. and/or its affiliates
# and other contributors as indicated by the @author tags.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@jcantrill
jcantrill / allocate-all-shards
Last active July 17, 2018 18:02
Allocate all non-assigned primary shards
#!/bin/bash
# This script allocates all primary shards that are unassigned to a a given node using
# the openshift binary. The binary must be in the path and the user executing the script
# must have access to logging project. The inputs are:
# pod An Elasticsearch pod name
# node An node Elasticsearch cluster which should be any one of the DC's. We could
# probably infer this from the pod name
pod=$1
node=$2
@jcantrill
jcantrill / unassigned
Last active July 24, 2018 20:28
Unassiged shards
#!/bin/bash
pod=$1
oc exec -c elasticsearch $pod -- es_util --query=_cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED
apiVersion: v1
data:
elasticsearch.yml: "cluster:\n name: ${CLUSTER_NAME}\n\nscript:\n inline: on\n
\ indexed: on\n\nindex:\n number_of_shards: \n number_of_replicas: \n unassigned.node_left.delayed_timeout:
2m\n translog:\n flush_threshold_size: 256mb\n flush_threshold_period:
5m\n\nnode:\n name: ${DC_NAME}\n master: ${IS_MASTER}\n data: ${HAS_DATA}\n
\ max_local_storage_nodes: 1\n\nnetwork:\n host: 0.0.0.0\n\ncloud:\n kubernetes:\n
\ pod_label: ${POD_LABEL}\n pod_port: 9300\n namespace: ${NAMESPACE}\n\ndiscovery:\n
\ type: kubernetes\n zen.ping.multicast.enabled: false\n zen.minimum_master_nodes:
${NODE_QUORUM}\n\ngateway:\n recover_after_nodes: ${NODE_QUORUM}\n expected_nodes:
$ ./logging.sh
/data/src/github.com/openshift/origin /data/src/github.com/openshift/origin-aggregated-logging/hack/testing
/data/src/github.com/openshift/origin-aggregated-logging/hack/testing
/data/src/github.com/openshift/origin-aggregated-logging /data/src/github.com/openshift/origin-aggregated-logging/hack/testing
/data/src/github.com/openshift/origin-aggregated-logging/hack/testing
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
centos-openshift-origin | 2.9 kB 00:00:00
centos-paas-sig-openshift-origin13-rpms | 2.9 kB 00:00:00
centos-paas-sig-openshift-origin14-rpms
@jcantrill
jcantrill / gist:56c2e5f036113667bae185241fa4f035
Last active June 8, 2017 19:13
Origin v1.5.1 inventory file
$ cat ../jctoolbox/openshift/origin-15.inventory
[OSEv3:children]
masters
nodes
[OSEv3:vars]
ansible_become=true
ansible_ssh_user=vagrant
ansible_ssh_private_key_file=/home/jeff.cantrill/.ssh/id_rsa
ansible_user=root
$ oc new-app logging-deployer-template -p MODE=reinstall
--> Deploying template "logging-deployer-template" in project "openshift"
logging-deployer-template
---------
Template for running the aggregated logging deployer in a pod. Requires empowered 'logging-deployer' service account.
* With parameters:
* MODE=reinstall
* IMAGE_PREFIX=docker.io/openshift/origin-
$ oc new-app logging-deployer-template -p MODE=install
--> Deploying template "logging-deployer-template" in project "openshift"
logging-deployer-template
---------
Template for running the aggregated logging deployer in a pod. Requires empowered 'logging-deployer' service account.
* With parameters:
* MODE=install
* IMAGE_PREFIX=docker.io/openshift/origin-
[jeff.cantrill@decker openshift]$ oc new-app 127.0.0.1/jcantrill/hello-openshift -o json
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {