ip2proxy/mongodb
IP2Proxy Proxy IP detection database with MongoDB setup.
67
This is a pre-configured, ready-to-run MongoDB server with IP2Proxy Proxy IP database. It simplifies the development team to install and set up the proxy IP database in MongoDB server. The setup script supports the commercial database packages and free LITE package. Please register for a download account before running this image.
docker run --name ip2proxy -d -e TOKEN={DOWNLOAD_TOKEN} -e CODE={DOWNLOAD_CODE} -e MONGODB_PASSWORD={MONGODB_PASSWORD} ip2proxy/mongodb
ENV VARIABLE
TOKEN – Download token obtained from IP2Location.
CODE – The CSV file download code. You may get the download code from your account panel.
MONGODB_PASSWORD - Password for MongoDB admin.
2. The installation may take seconds to minutes depending on your database sizes, downloading speed and hardware specs. You may check the installation status by viewing the container logs. Run the below command to check the container log:
docker logs -f ip2proxy
You should see the line `=> Setup completed` if you have successfully completed the installation.
sudo docker pull debian
sudo docker run --name debian-test -it debian bin/bash
sudo docker network create simple-network
sudo docker network connect simple-network ip2proxy
sudo docker network connect simple-network debian-test
sudo docker attach debian-test
Install MongoDB and Mongo Shell first by following the installation steps in https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/.
Run the Mongo Shell with the password you've specified during the installation.
mongosh --host ip2proxy -u mongoAdmin -p {MONGODB_PASSWORD} --authenticationDatabase admin
use ip2proxy_database
db.ip2proxy_database.findOne( { $and: [ { ip_from: { $lte: 134744072 } }, { ip_to: { $gte: 134744072 } } ] } )
use ip2proxy_database
db.ip2proxy_database.findOne( { $and: [ { ip_from_index: { $lte: "A0042541956123769884636017138956568135816" } }, { ip_to_index: { $gte: "A0042541956123769884636017138956568135816" } } ] } )
If you don't know how to convert an IP address to IP number, please see IP2Location FAQs.
NOTES: The search param for IPv4 database is a number BUT the param for IPv6 database is a string of the IP number left-padded with zeroes till 40 characters and prefixed with an "A". Also, IPv6 database is filtering on the ip_from_index and ip_to_index fields while IPv4 database is filtering on the ip_from and ip_to fields. When querying IPv4 address using the IPv6 database, you need to convert the IPv4 address into IPv4-mapped IPv6 address before converting to IP number.
To update your IP2Proxy database to latest version, please run the following command:
docker exec -it ip2proxy ./update.sh
You can visit the below link for more information about this docker image: IP2Proxy Articles and Tutorials
docker pull ip2proxy/mongodb