How Do You Solve This Problem “Error: Could not find or load main class org.apache.hadoop.util.VersionInfo”

Problem scenario
You run “hadoop version” but you receive this message “Error: Could not find or load main class org.apache.hadoop.util.VersionInfo”. What do you do?

Possible Solution #1
Use “sudo ” before the “hadoop version” command.

Possible Solution #2
Use “sudo -i ” before the “hadoop version” command.

Possible Solution #3
Use a different user.

 » Read more..

How Do You Get Hadoop Commands to Work from Any Directory without Using the Full Path?

Problem scenario
Hadoop is installed on Linux. But hadoop version and other hadoop commands are not working. What should you do?

Solution
Find the hadoop executable in a directory named bin. It is often “/usr/local/hadoop/bin/hadoop”. Ultimately you need to find the directory that houses this “bin.” has a subdirectory with “bin” and “hadoop” inside, run these two commands:

sudo find / -name hadoop -type f
whereis hadoop

Run these commands interactively where “/usr/local/hadoop” is the directory that is the parent of the subdirectory named “bin” that is the parent of the hadoop executable.

 » Read more..

What Command Do You Use to Check if Splunk is Installed?

Problem scenario
You want to find out what version of Splunk you are using. What command do you run?

Solution
Run this command: sudo /opt/splunk/bin/splunk version

If it does not work, run this command: sudo find / -name splunk -type f
Then run sudo /path/found/above/splunk/ version

 » Read more..

How Do You Troubleshoot the Go Programming Error ‘non-name m1[“foo”] on left side of :=’?

Problem scenario
You are running a Go program. You see this message about “command-line-arguments”:

non-name m1[“foo”] on left side of :=

What should you do?

Possible Solution
Can you try to use “=” instead of “:=”? This may fix your problem.

The := is a variable declaration and an assignment. If your map has been declared,

 » Read more..

How Do You Use a Function in Golang?

Solution
Prerequisite
This assumes that you have installed Golang; if you need assistance with this, see this posting.

Procedures
1. Create a file called b.go with this as the content:

package main

import “fmt”

// ContintFunction will display a message
func ContintFunction() {
fmt.Println(“Hello from Continual Integration”)
}

func main() {
ContintFunction()
}

2.

 » Read more..

How Do You Find out What Packages You Can Install That Are Related to a Certain Category when Using Ubuntu Linux?

Problem scenario
You want to find what Java packages are available on the configured repositories of the Linux server you are using. What do you do?

Solution

Run a command like this: apt-cache search java

You can replace “java” with a word of the package you want to install.

If you want to learn more about the package and have its exact name,

 » Read more..

How Do You Find out What Packages You Can Install That Are Related to a Certain Category when Using Linux SUSE?

Problem scenario
You want to find what Java packages are available on the configured repositories of the Linux SUSE server you are using. What do you do?

Solution
Run this command: zypper se java

You can replace “java” with a word of the package you want to install.

 » Read more..

In Python, How Do You Call a Bound Function as a New Thread with the thread Module?

Problem scenario
You want to write a program to call a bound function in a new thread. How do you do this?

Solution
Run this program (e.g., python foobar.py):

import _thread as thread
class mighty:
def cool():
print(“Cool.”)
def contint():
print(“Hello!”)
if name == “main”:
foobar = thread.start_new_thread(mighty.cool, () )
print(“thread finished…exiting”)

 » Read more..

How Do You Generate a 100 GB Log File?

Problem scenario
You want to generate a large log file to use later on (e.g., for the Elastic Stack or Splunk). How do you create a 100 GB log file?

Solution
Find an example log to base the generation off. Run these commands to find a log that you would want to copy its format:

cd /var/log
ls -lh –sort=size
sudo tail foobar # where foobar is the name of the log file you want to sample

2.

 » Read more..

How Do You Create Bytecode with Golang?

Problem scenario
You want to create bytecode using Golang. What do you do.

Solution
Prerequisite
Install Golang. If you need assistance, see this posting.

Procedures
Create a Go script that you can run with go run nameOfProgram.go
Run this: go build nameOfProgram.go
Run this: ./nameOfProgram

 » Read more..