Skip to content

Commit

Permalink
Merge pull request #152 from EMCECS/develop
Browse files Browse the repository at this point in the history
Merge Develop into Master
  • Loading branch information
APeter0807 committed Jul 26, 2016
2 parents 5b96a97 + 29bb4b2 commit d1a8a20
Show file tree
Hide file tree
Showing 17 changed files with 2,077 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Documentation/ECS-MultiNode-Instructions.md
Expand Up @@ -115,7 +115,7 @@ In addition, please refer to the [ECS Security Configuration Guide](https://comm
### Host Configuration
#### :bangbang: WARNING: This is a destructive operation. Existing data on selected storage devices will be overwritten. Existing Docker installations AND images will be removed.

The following section needs to be performed on each one of the ECS nodes:
**The following section needs to be performed on each one of the ECS nodes:**

1. **Perform Updates:** Perform a Yum update using `sudo yum update` and download packages required for installation using `sudo yum install git tar wget`

Expand All @@ -132,7 +132,7 @@ The following section needs to be performed on each one of the ECS nodes:
|ecstestnode3 | 10.0.1.12 |sdc sdd | eth0 |
|ecstestnode4 | 10.0.1.13 |sdc sdd | eth0 |

5. Use gathered values for each ECS node (IP addresses, hostnames, ethernet adapter name, disk names) to build the `step1_ecs_multinode_install.py` script, which will be the same across all nodes. For our example values, the command should look like this:
5. Use gathered values for each ECS node (IP addresses, hostnames, ethernet adapter name, disk names) to build the `step1_ecs_multinode_install.py` script, which will be the same across all nodes. Be advised that **the hostname can not be localhost for any node**. For our example values, the command should look like this:

`sudo python step1_ecs_multinode_install.py --ips 10.0.1.10 10.0.1.11 10.0.1.12 10.0.1.13 --hostnames ecstestnode1 ecstestnode2 ecstestnode3 ecstestnode4 --disks sdc sdd --ethadapter eth0`

Expand Down
9 changes: 8 additions & 1 deletion Documentation/ECS-Troubleshooting.md
Expand Up @@ -37,6 +37,11 @@ If you want to see if system is making progress:
`curl -X GET "http://<YourIPAddress>:9101/stats/dt/DTInitStat”`


### Docker Container immediately exits on startup

If your docker instance immediately exits when started, please ensure that the entries in `/etc/hosts` on the host system and `network.json` in the install directory are correct (the latter should reflect the host's public IP and the corresponding network adapter).


### For those operating behind EMC firewall

To install ECS Community Edition under these conditions, please view the readme file under **/emc-ssl-cert** for further instructions in installing the necessary CA certificate.
Expand All @@ -57,7 +62,7 @@ Ensure the ports in the following table are open for communication. In the case

`firewall-cmd --permanent --zone=trusted --add-source=<ECS-node-IP>/32`

followed by `firewall-cmd --reboot` for each host.
followed by `firewall-cmd --reload` for each host.

`fwd_settings.sh` in the main directory will invoke the `firewalld` service and permanently open necessary ports. In the case of a failure in this setup referencing `iptables`, please ensure that your docker network bridge is running and installed using `yum install bridge-utils`.

Expand All @@ -76,6 +81,7 @@ In the case of a multiple node configuration, you may
|port.blob=1098|
|port.provision=1198|
|port.objhead=1298|
|port.nfs=2049|
|port.zookeeper=2181|
|port.coordinator=2889|
|port.cassvc=3218|
Expand Down Expand Up @@ -116,6 +122,7 @@ In the case of a multiple node configuration, you may
|port.hdfs=9208|
|port.event=9209|
|port.objcontrolsvc=9212|
|port.zkutils=9230|
|port.cas=9250|
|port.resource=9888|
|port.tcpIpcServer=9898|
21 changes: 14 additions & 7 deletions ecs-multi-node/step1_ecs_multinode_install.py
Expand Up @@ -12,6 +12,7 @@
import time
import settings
import re
import StringIO

# Logging Initialization
logging.config.dictConfig(settings.ECS_SINGLENODE_LOGGING)
Expand Down Expand Up @@ -282,12 +283,12 @@ def prepare_data_disk_func(disks):
logger.info("Make File filesystem in '{}'".format(device_name))
subprocess.call(["mkfs.xfs", "-f", device_name])

uuid_name = "uuid-{}".format(index + 1)
# mkdir -p /ecs/uuid-1
uuid_name = uuid_filename(device_name)
# mkdir -p /ecs/uuid-[uuid]
logger.info("Make /ecs/{} Directory in attached Volume".format(uuid_name))
subprocess.call(["mkdir", "-p", "/ecs/{}".format(uuid_name)])

# mount /dev/sdc1 /ecs/uuid-1
# mount /dev/sdc1 /ecs/uuid-[uuid]
logger.info("Mount attached {} to /ecs/{} volume.".format(device_name, uuid_name))
subprocess.call(["mount", device_name, "/ecs/{}".format(uuid_name), "-o", "noatime,seclabel,attr2,inode64,noquota"])

Expand All @@ -308,6 +309,11 @@ def prepare_data_disk_func(disks):
logger.fatal("Aborting program! Please review log.")
sys.exit()

def uuid_filename(device_name):
blkd_id_process = subprocess.Popen(["blkid", "-s", "UUID", "-o", "value", device_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = blkd_id_process.communicate()
return "uuid-{}".format(stdout.strip())


def clean_data_disk_func(disks):
"""
Expand All @@ -320,13 +326,14 @@ def clean_data_disk_func(disks):
disk_path = "/dev/{}".format(disk)

device_name = disk_path + "1"
uuid_name = uuid_filename(device_name)
uuid_name = "uuid-{}".format(index + 1)

# umount /dev/sdc1 /ecs/uuid-1
# umount /dev/sdc1 /ecs/uuid-[uuid]
logger.info("Umount attached /dev{} to /ecs/{} volume.".format(device_name, uuid_name))
subprocess.call(["umount", device_name, "/ecs/{}".format(uuid_name)])

# rm -rf /ecs/uuid-1
# rm -rf /ecs/uuid-[uuid]
logger.info("Remove /ecs/{} Directory in attached Volume".format(uuid_name))
subprocess.call(["rm", "-rf", "/ecs/{}".format(uuid_name)])

Expand Down Expand Up @@ -475,7 +482,7 @@ def set_docker_configuration_func():
logger.info("Set container to start on boot.")
subprocess.call(["systemctl", "enable", "docker.service"])
os.system("echo \"docker start ecsmultinode\" >>/etc/rc.local")

os.system("chmod +x /etc/rc.d/rc.local")

except Exception as ex:
logger.exception(ex)
Expand Down Expand Up @@ -661,7 +668,7 @@ def main():
parser.add_argument('--imagetag', dest='imagetag', nargs='?',
help='If present, pulls a specific version of the target image from DockerHub. Defaults to latest',
required=False)
parser.add_argument('--use-urandom', dest='use_urandom', action='store_true', default=False,
parser.add_argument('--use-urandom', dest='use_urandom', action='store_true', default=True,
help='If present, /dev/random will be mapped to /dev/urandom on the host. If you container starts up slow the first time could help.',
required=False)
parser.add_argument('--no-internet', dest='no_internet', action='store_true', default=False,
Expand Down
23 changes: 15 additions & 8 deletions ecs-single-node/step1_ecs_singlenode_install.py
Expand Up @@ -16,6 +16,7 @@
import socket
import fcntl
import struct
import StringIO


# Logging Initialization
Expand Down Expand Up @@ -275,12 +276,12 @@ def prepare_data_disk_func(disks):
logger.info("Make File filesystem in '{}'".format(device_name))
subprocess.call(["mkfs.xfs", "-f", device_name])

uuid_name = "uuid-{}".format(index + 1)
# mkdir -p /ecs/uuid-1
uuid_name = uuid_filename(device_name)
# mkdir -p /ecs/uuid-[uuid]
logger.info("Make /ecs/{} Directory in attached Volume".format(uuid_name))
subprocess.call(["mkdir", "-p", "/ecs/{}".format(uuid_name)])

# mount /dev/sdc1 /ecs/uuid-1
# mount /dev/sdc1 /ecs/uuid-[uuid]
logger.info("Mount attached {} to /ecs/{} volume.".format(device_name, uuid_name))
subprocess.call(["mount", device_name, "/ecs/{}".format(uuid_name), "-o", "noatime,seclabel,attr2,inode64,noquota"])

Expand All @@ -301,6 +302,11 @@ def prepare_data_disk_func(disks):
logger.fatal("Aborting program! Please review log.")
sys.exit()

def uuid_filename(device_name):
blkd_id_process = subprocess.Popen(["blkid", "-s", "UUID", "-o", "value", device_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = blkd_id_process.communicate()
return "uuid-{}".format(stdout.strip())


def run_additional_prep_file_func(disks):
"""
Expand Down Expand Up @@ -401,7 +407,8 @@ def set_docker_configuration_func():
logger.info("Set container to start on boot.")
subprocess.call(["systemctl", "enable", "docker.service"])
os.system("echo \"docker start ecsstandalone\" >>/etc/rc.local")
os.system("chmod +x /etc/rc.d/rc.local")
os.system("chmod +x /etc/rc.d/rc.local")

except Exception as ex:
logger.exception(ex)
logger.fatal("Aborting program! Please review log")
Expand Down Expand Up @@ -607,13 +614,13 @@ def cleanup_installation(disks):
disk_path = "/dev/{}".format(disk)

device_name = disk_path + "1"
uuid_name = "uuid-{}".format(index + 1)
uuid_name = uuid_filename(device_name)

# umount /dev/sdc1 /ecs/uuid-1
# umount /dev/sdc1 /ecs/uuid-[uuid]
logger.info("Umount attached /dev{} to /ecs/{} volume.".format(device_name, uuid_name))
subprocess.call(["umount", device_name, "/ecs/{}".format(uuid_name)])

# rm -rf /ecs/uuid-1
# rm -rf /ecs/uuid-[uuid]
logger.info("Remove /ecs/{} Directory in attached Volume".format(uuid_name))
subprocess.call(["rm", "-rf", "/ecs/{}".format(uuid_name)])

Expand Down Expand Up @@ -687,7 +694,7 @@ def main():
parser.add_argument('--imagetag', dest='imagetag', nargs='?',
help='If present, pulls a specific version of the target image from DockerHub. Defaults to latest',
required=False)
parser.add_argument('--use-urandom', dest='use_urandom', action='store_true', default=False,
parser.add_argument('--use-urandom', dest='use_urandom', action='store_true', default=True,
help='If present, /dev/random will be mapped to /dev/urandom on the host. If you container starts up slow the first time could help.',
required=False)
parser.add_argument('--no-internet', dest='no_internet', action='store_true', default=False,
Expand Down
6 changes: 3 additions & 3 deletions fwd_settings.sh
@@ -1,18 +1,18 @@
#!/bin/bash
# Updates FirewallD settings with trusted ports in accordance with ECS requirements.

tcpadd=( 2 25 111 80 389 443 636 1095 1096 1098 1198 1298 2181 2889 3218 4443 5120 5123 7399 7400 7578 9010 9011 9020-9025 9028 9029 9040 9069 9091 9094-9101 9111 9201-9206 9208 9209 9212 9250 9888 9898 )
tcpadd=( 2 25 111 80 389 443 636 1095 1096 1098 1198 1298 2049 2181 2889 3218 4443 5120 5123 7399 7400 7578 9010 9011 9020-9025 9028 9029 9040 9069 9091 9094-9101 9111 9201-9206 9208 9209 9212 9230 9250 9888 9898 )
udpadd=( 1095 1096 1098 1198 1298 3218 9091 9094 9100 9201 9203 9208 9209 9250 9888 )

systemctl enable firewalld
systemctl start firewalld

for port in "${tcpadd[@]}"; do
firewall-cmd --permanent --add-port=$port/tcp
done
for port in "${udpadd[@]}"; do
firewall-cmd --permanent --add-port=$port/udp
done

firewall-cmd --reload

done
exit 0
17 changes: 17 additions & 0 deletions patches/2.2.1.0/Dockerfile
@@ -0,0 +1,17 @@
# Four fixes to the default 2.2.1.0 image.
FROM emcvipr/object:2.2.1.0-77331.4f57cc6-reduced

# Reduce timeout for systems that are shutdown for a while
ADD coordinator.properties /opt/storageos/conf/
# Increase memory for transformsvc
ADD transformsvc /opt/storageos/bin/

# Fix disk partitioning script
ADD storageserver-partition-config.sh /opt/storageos/bin/

# Make vnest use separate thread pools to prevent deadlock
#ADD vnest.object.properties /opt/storageos/conf/
RUN f=/opt/storageos/conf/vnest-common-conf-template.xml; grep -q "object.UseSeparateThreadPools" $f || sed -i '/properties id="serviceProperties"/a \ \ \ \ \ \ \ \ <prop key="object.UseSeparateThreadPools">true</prop>' $f

# Remove forced exit from systool
ADD systool /etc/
13 changes: 13 additions & 0 deletions patches/2.2.1.0/coordinator.properties
@@ -0,0 +1,13 @@
# genconfig will set flag based on control node vs. data node
coordinator.useExternalConfig=true
coordinator.serverClientPort=2181
coordinator.dataDir=/data/zk
coordinator.serverConfigFile=/data/vnest/vnest-main/configuration/coord-server
coordinator.clientConfigFile=/data/vnest/vnest-main/configuration/coord-client
coordinator.lastServedFile=/data/vnest/vnest-main/configuration/coord-last-served
# if node down for this long, wait to see if still member before proceeding
coordinator.lastServedThreshSecs=3600
# if lastServedThreshSecs exceeded, wait this long for config to be updated
coordinator.lastServedTimeoutSecs=5
# how often to touch last served file
coordinator.lastServedUpdateSecs=120
119 changes: 119 additions & 0 deletions patches/2.2.1.0/storageserver-partition-config.sh
@@ -0,0 +1,119 @@
#!/bin/bash
# Copyright (c) 2013 EMC Corporation
# All Rights Reserved
#
# This software contains the intellectual property of EMC Corporation
# or is licensed to EMC Corporation from third parties. Use of this
# software and the intellectual property contained therein is expressly
# limited to the terms and conditions of the License Agreement under which
# it is provided by or on behalf of EMC.
#

date

# This script will generate the partition file (ss-partition-conf.json) to be used on this server if one is not found.
# Also a general configuration file will be generated with main parameters and a ss uuid.
# Assumes this is running on gen 3 hardware or a vipr data test node using disks mounted with a
# /dae/uuid-58f917ab-23ba-457f-a9df-d0f4b0597e2d type pattern or will look for /data (vipr)

export configdir="/opt/storageos/conf"

export p_configfile="$configdir/storageserver-partition-conf.json"
export configfile="$configdir/storageserver.conf"

blockbinsizegb=10
vm_bb_cout=5
vm_part_count=5

function setopt() {
opt=$1
val=$2
if grep -q "$opt" "$configfile" ; then
sed -i "s#$opt=.*#$opt=$val#g" "$configfile"
else
echo "$opt=$val" >> $configfile
fi

}

echo "creating main config file: $configfile"
if [ ! -e "$configfile" ]; then
echo "creating $configfile"
mkdir -p "$configdir"
cat << EOF > "$configfile"
listenaddress=0.0.0.0
port=9099
iothreads=100
blockbinsizegb=$blockbinsizegb
debugenabled=false
logtoconsole=false
logtosyslog=true
maxoutstandingrequests=0
initblockbins=0
netserverListenPort=9069
netserverLogLevel=INFO
ioThreadNumber=200
perfCountEnabled=true
maxMemThresholdKb=3145728
sendQHighWaterMark=1000
recvThreadNicePriority=-15
sendThreadNicePriority=-15
enableAffinity=true
partitionroot=/dae
agentUrlEndPoint=/host/data/agent.json
agentDisksRestFragment=/v1/agent/node/storage/disk/disks
trustStore=/host/data/security/truststore.pem
verifyCerts=true
dbusEnabled=false
EOF
else
echo "$configfile already exists, no action taken"
fi

if grep -q -E 'VMware.*Virtual.*disk' /proc/scsi/sg/device_strs && [ ! -e /data/is_community_edition ]
then
# this a virtual datanode, creating a json file with predefined values
echo "virtual node detected - using json config file"
setopt partitionconfig $p_configfile
setopt partitionroot=/dae
root="/data/storageserver"

for part in $(seq 1 $vm_part_count); do
for bb in $(seq 1 $vm_bb_cout); do
bb=$(printf "%0*d\n" 4 $bb)
mkdir -m 777 -p $root/uuid-$part
fallocate -l${blockbinsizegb}G $root/uuid-$part/$bb
chmod 777 $root/uuid-$part/$bb
done
done

if [ ! -e "$p_configfile" ]; then
echo "creating $p_configfile"
mkdir -p "$configdir"

printf '{\n%2s"disks": [\n' > $p_configfile
for part in $(seq 1 "$vm_part_count"); do
printf '%4s{\n%6s"uuid": "'$part'",\n%6s"health": "Good"\n%4s}' >> $p_configfile
[ "$part" -lt "$vm_part_count" ] && echo "," >> $p_configfile || echo "" >> $p_configfile
done
printf '%2s]\n}' >> $p_configfile

else
echo "$p_configfile already exists, no action taken"
fi
else
# this is a commodity hardware node. do not generate a json file - ss will use dbus to obtain partitions
echo "commodity node detected - using dbus api"
fi

if ! grep --quiet "uuid" "$configfile"; then
echo "generating server uuid"
uuidgen="$(which uuidgen)"
if [ ! -z "$uuidgen" ]; then
uuid="$(uuidgen)"
else
echo "warning: uuidgen utility was not found on your system. using timestamp as a uuid"
uuid="$(date +%s)"
fi
setopt uuid "$uuid"
fi

0 comments on commit d1a8a20

Please sign in to comment.