solr9

How To configure apache solr 9.0.0 dataimport handler


I am not getting correct way of configure dataimport handler. i want to import mysql AND SQL server dataimport in solr.

Want to import mysql database in solr version. or migrate solr version 8 to 9.

I was configure dataimport handler old way but this not work i mean after configuration core is not load.


Solution

  • Now i searching New solution on those problem's in Linux based system.

    firstly you set your Apache solr and configure it.

    and you simply Create a .sh file and enter following content in this file.

    nano FILE_NAME

        #!/bin/bash
        
        # MySQL Database Configuration
        MYSQL_HOST="DATABASE_IP"
        MYSQL_USER="USER"
        MYSQL_PASSWORD="Password"
        MYSQL_DATABASE="pulse"
        LAST_INDEX_TIME_FILE="$HOME/.dataimport.properties"
        
        # Solr Configuration
        SOLR_URL="http://localhost:YOUR_SOLR_PORT/solr"
        COLLECTION_NAME="kaldin"
        SOLR_POST_TOOL="/opt/solr/bin/post"  # Replace with your Solr bin/post tool path
        
        # Get the last index time from a file
        LAST_INDEX_TIME=$(cat $LAST_INDEX_TIME_FILE)
        
        # MySQL query to retrieve data modified since the last index time
        MYSQL_QUERY="SELECT client_id, 
                        client_siffix, client_first_name, client_middle_name, client_last_name, client_email, client_phone_1, client_phone_2,
                        fk_client_enum_id, client_u_id, fk_company_id, 
                        client_status, client_is_active, client_modified_date, fk_client_team_id, fk_client_team_id1 FROM client;" > '$LAST_INDEX_TIME'
        
        # Execute the MySQL query and transform data if needed
        MYSQL_OUTPUT=$(mysql -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE -e "$MYSQL_QUERY")
        
        # Prepare the data for Solr (e.g., convert to JSON)
        # Modify this part based on your data format and requirements
        
        # Use Solr's post tool to send the data to Solr
        echo "$MYSQL_OUTPUT" | $SOLR_POST_TOOL -c $COLLECTION_NAME -d
        
        # Record the current time as the last index time
        date +"%Y-%m-%d %H:%M:%S" > $LAST_INDEX_TIME_FILE
    

    after that give this file full permission using chmod
    chmod 777 FILE_NAME