domingo, outubro 27, 2024

Zookeeper\Solr - Linux Installation Reference

Below are the steps to install Solr and Zookeeper on Debian 12.7.

I have these servers:

Solr Nodes:
hqew1ww-rg-p04-solr-1  172.24.122.4:8983/solr/
hqew1ww-rg-p04-solr-2  172.24.122.5:8983/solr/
hqew1ww-rg-p04-solr-3  172.24.122.6:8983/solr/

Update System

$sudo apt update && sudo apt upgrade -y 

Install Java JDK

$sudo apt install default-jdk 

Check Java

$java -version

Download Solr, Install, Check Services

$cd /opt/
$sudo wget https://archive.apache.org/dist/lucene/solr/8.11.2/solr-8.11.2.tgz
$sudo tar xzf solr-8.11.2.tgz
$sudo bash solr-8.11.2/bin/install_solr_service.sh solr-8.11.2.tgz
$sudo systemctl status solr

Download Zookeeper

$sudo wget https://downloads.apache.org/zookeeper/stable/apache-zookeeper-3.8.4-bin.tar.gz
$sudo tar -xvzf apache-zookeeper-3.8.4-bin.tar.gz

Rename Directory

$sudo mv apache-zookeeper-3.8.4-bin zookeeper

Create a Zookeeper User and Group

$sudo useradd -m -r -d /var/lib/zookeeper -s /bin/false zookeeper


Set Ownership and Permissions

$sudo mkdir -p /var/lib/zookeeper
$sudo chown -R zookeeper:zookeeper /opt/zookeeper sudo chown -R zookeeper:zookeeper /var/lib/zookeeper
 
Create a Config File

$sudo vim /opt/zookeeper/conf/zoo.cfg

Config file content:

tickTime=2000
initLimit=10
syncLimit=5
dataDir=/var/lib/zookeeper
clientPort=2181
server.1=172.24.122.4:2888:3888
server.2=172.24.122.5:2889:3889
server.3=172.24.122.6:2890:3890

The Command Below Starts the Zookeeper (If you want to test before run as a service)

$/opt/zookeeper/bin/zkServer.sh start

The Command Below Connects to Zookeeper

$/opt/zookeeper/bin/zkCli.sh -server 127.0.0.1:2181

To Stop

$/opt/zookeeper/bin/zkServer.sh stop

Create a System Service

$sudo vim /etc/systemd/system/zookeeper.service

[Unit]
Description=Zookeeper Daemon
Documentation=http://zookeeper.apache.org
Requires=network.target
After=network.target

[Service]
Type=forking
WorkingDirectory=/opt/zookeeper
User=zookeeper
Group=zookeeper
ExecStart=/opt/zookeeper/bin/zkServer.sh start /opt/zookeeper/conf/zoo.cfg
ExecStop=/opt/zookeeper/bin/zkServer.sh stop /opt/zookeeper/conf/zoo.cfg
ExecReload=/opt/zookeeper/bin/zkServer.sh restart /opt/zookeeper/conf/zoo.cfg
TimeoutSec=30
Restart=on-failure

[Install]
WantedBy=default.target

Reload System Daemon

$sudo systemctl daemon-reload

 Start the Zookeeper Service and Enable It to Start After System Reboot Using the Following Commands:

$sudo systemctl start zookeeper 
$sudo systemctl enable zookeeper

Error Encountered

I found an error when I tried to start the service due to permission issues. The reason is that I ran the command /opt/zookeeper/bin/zkServer.sh start using my root account. The directory /opt/zookeeper/logs/ did not have permission for the zookeeper user, and the directories were created when I tried to run the service to test using bash.

These Were the Errors:

hqew1ww-rg-p04-solr-1 zkServer.sh[3724919]: /opt/zookeeper/bin/zkServer.sh: line 164: /opt/zookeeper/bin/../logs/zookeeper-zookeeper-server-hqew1ww-rg-p04-solr-1.out: Permission denied
hqew1ww-rg-p04-solr-1 zkServer.sh[3724920]: /opt/zookeeper/bin/zkServer.sh: line 175: /var/lib/zookeeper/zookeeper_server.pid: Permission denied

You Can Check the Permissions:

$ls -lha /opt/zookeeper/logs/
$ls -lha /var/lib/zookeeper

Solution: 

Simply delete the directories or configure the ownership. The owner should be the zookeeper user.

###

 Solr Cloud (Cluster)

### 

$sudo vim /etc/default/solr.in.sh 

ZK_HOST="172.24.122.4:2181,172.24.122.5:2181,172.24.122.6:2181" 
SOLR_MODE="solrcloud"
 
Edit the Zookeeper configuration file and add the permissions:
 
$sudo vim /opt/zookeeper/conf/zoo.cfg
 
4lw.commands.whitelist=mntr,conf,ruok

Restart Solr and Zookeeper

I had an issue with ZooKeeper when I opened Solr and checked the nodes. I received the following message: 

'Only one zk allowed in standalone mode'

The issue was related to the configuration file.

server.1=172.24.122.4:2888:3888
server.2=172.24.122.5:2889:3889
server.3=172.24.122.6:2890:3890

You must use 'server' at the beginning of the line; any other value will cause your ZooKeeper to fail.


 

segunda-feira, abril 01, 2024

Steps to rename an Active Directory Domain

There are some requirements that I have not added to this article; you can find them in Microsoft articles.

 I will run the commands in a domain member machine, not in the domain controller. In the domain member server:

>Install-WindowsFeature RSAT-AD-Tools -IncludeAllSubFeature

 In the domain controller create a DNS zone for your new domain:

OLD Domain: contoso.com

New Domain: contosonew.com

 >Add-DnsServerPrimaryZone -Name contosonew.com -ReplicationScope "Domain" –PassThru

In the domain member-run:

>rendom /list 


A Domainlist.xml will be created. You need to edit the file and replace the DNSname and NetBiosName

<?xml version ="1.0"?>
<Forest>
    <Domain>
        <!-- PartitionType:Application -->
        <Guid>891277a0-70de-4f9d-a176-80140ea9c334</Guid>
        <DNSname>ForestDnsZones.contosonew.com</DNSname>
        <NetBiosName></NetBiosName>
        <DcName></DcName>
    </Domain>
    <Domain>
        <!-- PartitionType:Application -->
        <Guid>e60931a4-f3e9-4b7c-8ae2-1e4d2078338c</Guid>
        <DNSname>DomainDnsZones.contosonew.com</DNSname>
        <NetBiosName></NetBiosName>
        <DcName></DcName>
    </Domain>
    <Domain>
        <!-- ForestRoot -->
        <Guid>e070ac56-99c0-4005-8193-40535c6eabd1</Guid>
        <DNSname>contosonew.com</DNSname>
        <NetBiosName>CONTOSO</NetBiosName>
        <DcName></DcName>
    </Domain>
</Forest>

>rendom /showforest

Upload the file:

>rendom /upload

Prepare:

>rendom /prepare

Execute, Domain Controllers will be restarted automatically
>rendom /execute

 

 Fix the GPO issues in the domain controller:

gpfixup /olddns:contoso.com /newdns:contosonew.com


gpfixup /oldnb:TEST /newnb:RESOURCE

Rename the Domain Controllers:

netdom computername DC1.contoso.com /add:DC1.contosonew.com
netdom computername DC1.contosonew.com /makeprimary:DC1.contosonew.com

Remove the old reference to the old domain

rendom /clean

Finish the process (For me I got several error, and after a few minutes and was able to finish the process):

rendom /end