Skip to content

Instantly share code, notes, and snippets.

@wkharold
wkharold / elasticsearch-lb.log
Created August 27, 2015 20:06
kubectl logs logstash -c elasticsearch-lb
wkhhdmbp:kubernetes-elk-cluster wkh$ kubectl logs -f logstash-60j4v -c elasticsearch-lb │ 43 - containerPort: 5043
log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.DailyRollingFileAppender. │ 44 name: lumberjack
log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.DailyRollingFileAppender. │ 45 protocol: TCP
log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.DailyRol
s := srv.NewFileSrv(root)
s.Dotu = true
if *fldebug {
s.Debuglevel = 1
}
s.Start(s)
if err := s.StartNetListener("tcp", *flfsaddr); err != nil {
glog.Errorf("listener failed to start (%v)", err)
os.Exit(1)
@wkharold
wkharold / gist:9861636
Last active August 29, 2015 13:57
mkjobfs
/*** jobd.go ***/
// mkjobfs creates the static portion of the jobd file hierarchy: the 'clone'
// file, and the 'jobs' directory at the root of the hierarchy.
func mkjobfs() (*srv.File, error) {
var err error
user := p.OsUsers.Uid2User(os.Geteuid())
root := new(srv.File)
func main() {
// argument handling and initialization
root, err := mkjobfs()
if err != nil {
os.Exit(1)
}
// job database management
/*** clone.go ***/
type clonefile struct {
srv.File
}
// Write handles writes to the clone file by attempting to parse the data being
// written into a job definition and if successful adding the corresponding job
// to the jobs directory.
func (k *clonefile) Write(fid *srv.FFid, data []byte, offset uint64) (int, error) {
glog.V(4).Infof("Entering clonefile.Write(%v, %v, %v)", fid, data, offset)
/*** job.go ***/
type jobdef struct {
name string
schedule string
cmd string
state string
}
type jobreader func() []byte
type jobwriter func([]byte) (int, error)
/*** job.go ***/
// Read handles read operations on a jobfile using its associated reader.
func (jf jobfile) Read(fid *srv.FFid, buf []byte, offset uint64) (int, error) {
glog.V(4).Infof("Entering jobfile.Read(%v, %v, %)", fid, buf, offset)
defer glog.V(4).Infof("Exiting jobfile.Read(%v, %v, %v)", fid, buf, offset)
cont := jf.reader()
if offset > uint64(len(cont)) {
return 0, nil
/*** job.go ***/
// run executes the command associated with a job according to its schedule and
// records the results until it is told to stop.
func (j *job) run() {
j.history.Value = fmt.Sprintf("%s:started\n", time.Now().String())
j.history = j.history.Next()
for {
now := time.Now()
e, err := cronexpr.Parse(j.defn.schedule)
if err != nil {
@wkharold
wkharold / etcdcmds.txt
Created December 16, 2014 20:50
Issue getting etcdctl to talk to non-local etcd
core@db01 ~ $ ping 10.240.169.79
PING 10.240.169.79 (10.240.169.79) 56(84) bytes of data.
64 bytes from 10.240.169.79: icmp_seq=1 ttl=64 time=0.849 ms
64 bytes from 10.240.169.79: icmp_seq=2 ttl=64 time=0.404 ms
^C
--- 10.240.169.79 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.404/0.626/0.849/0.223 ms
core@db01 ~ $ export ETCDCTL_PEERS="http://10.240.169.79:4001"
core@db01 ~ $ etcdctl --debug set /tmp/foo "bar"
@wkharold
wkharold / crate@.service
Created January 26, 2015 21:13
unit file for crate deployment in CoreOS Easy Development/Testing Cluster deployment
[Unit]
Description=crate
After=docker.service
Requires=docker.service
[Service]
TimeoutSec=3600
ExecStartPre=/bin/bash -c "/usr/bin/docker rm %p || exit 0"
ExecStartPre=/usr/bin/mkdir -p /mnt/data1/crate
ExecStartPre=/usr/bin/docker pull crate:latest